Commit Graph

60 Commits

Author SHA1 Message Date
SupSuper
d0512db25c WIN32: Move all ARRAYSIZE undefs to util.h
Instead of trying to undefine ARRAYSIZE everywhere we use a Windows header, let's just do it before we define our own
2018-12-17 12:28:33 +02:00
Bastien Bouclet
955e18c648 COMMON: Use nullptr instead of NULL or 0 where appropriate 2018-05-10 08:35:46 +02:00
Eugene Sandulenko
940b2a20f1 Revert "COMMON: Change way the Singleton instances are instantiated"
This reverts commit eefa72afa1.

With this patch ConfigManager is broken.
2017-07-10 21:17:41 +02:00
Thierry Crozat
eefa72afa1 COMMON: Change way the Singleton instances are instantiated
This fixes tons of warnings with clang from a recent xcode version on
macOS (and possibly other systems) complaining that an instantiation
of _singleton is required but no definition is available.
2017-07-10 21:11:20 +02:00
Johannes Schickel
854e22b38b COMMON: Make GPL headers consistent in themselves. 2014-02-18 02:39:33 +01:00
Christoph Mallon
e40ba4c135 JANITORIAL: Simply use *x instead of *x.get() on smart pointers. 2012-03-13 15:43:59 +01:00
Johannes Schickel
f63df3bf7b GRAPHICS/GUI: Implement charset mapping for TTF fonts.
The charsets used by the translations now need to have a "$(name).cp" file,
which contains an charset index => unicode mapping. Otherwise
create_translations will fail.
2012-01-29 16:26:20 +01:00
Johannes Schickel
3ddea4952d COMMON: Some minor formatting fixes in translation code.
Done by running astyle over the files.
2011-11-13 01:43:41 +01:00
Eugene Sandulenko
022857a371 COMMON: Fix warning 2011-11-02 22:09:17 +00:00
Chris Warren-Smith
8a2243ff36 BADA: Remove BADA defined check. Was a temp fix for simulator build 2011-08-21 16:39:08 +10:00
Chris Warren-Smith
59739a7a0e BADA: Initial BADA port implementation 2011-08-21 16:37:06 +10:00
Ori Avtalion
aa0f307e06 ALL: Require DECLARE_SINGLETON to be used in the Common namepsace
Silences the clang warning:

  static data member specialization of '_singleton' must
  originally be declared in namespace 'Common'; accepted as a C++0x
  extension [-Wc++0x-extensions]

Wrapping "namespace Common {}" around the macro assignment causes clang
to complain about a spurious semicolon, and removing the semicolon at
the end of the macro causes some editors to misbehave.

Changing the requirement of using the macro in one namespace (the
global) to another (Common) seems a small price to pay to
silence a warning.
2011-06-30 22:41:41 +03:00
Thierry Crozat
b35f4d31a6 COMMON: Look for translations.dat in Theme path before using SearchMan 2011-06-24 20:21:08 +01:00
Thierry Crozat
2109fc7a3c COMMON: Improve loading of translations data file
Now if the header of the file is not correct it continues to look for a
valid file, while before if the first file found was obsolete or corrupted
translation was disabled even if a valid file was present in the search
path.
2011-06-22 22:48:08 +01:00
Thierry Crozat
38c9988938 COMMON: Fix crash in TranslationManager when reading long strings
It was writing data beyond the end of a buffer. This change makes
sure this does not happen. It only changes reading of the messages
since the language codes, charset names and contexts are always
much smaller than the buffer.
2011-06-14 23:15:50 +01:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Ori Avtalion
9414d7a6e2 JANITORIAL: Reduce header dependencies in shared code
Some backends may break as I only compiled SDL
2011-04-28 15:08:58 +03:00
Jordi Vilalta Prat
a17c07bcaa I18N: Improve the fallback language auto-detection.
- Broaden the range of language tags that could be accepted as fallback in
  auto-detection. For example, for a system with locale 'pt_PT', all of
  these would be accepted as valid fallbacks: 'pt_PT_*', 'pt', 'pt_*'
- Make language codes matching case-insensitive as specified in RFC 4647.
- Add support language code blocks longer than 2 characters.

svn-id: r54715
2010-12-01 20:00:40 +00:00
Jordi Vilalta Prat
8393bc5b5f I18N: Don't build TranslationManager when translation is disabled.
svn-id: r54684
2010-11-30 18:50:19 +00:00
Johannes Schickel
1ad63b431e BACKEND: Switch OSystem::getSystemLanguage return type to Common::String.
This is done as discussed on -devel.

svn-id: r54516
2010-11-28 02:12:33 +00:00
Johannes Schickel
ebbd504b90 COMMON: Adapt translation manager to use the OSystem for language detection.
svn-id: r54480
2010-11-25 18:42:05 +00:00
Max Horn
785590e504 COMMON: Push include file.h and fs.h from translation.h to translation.cpp
svn-id: r54357
2010-11-19 01:03:05 +00:00
Max Horn
abe1959d36 COMMON: Simplify DECLARE_SINGLETON macro
This makes it possible to write
  DECLARE_SINGLETON(foo);
instead of
  DECLARE_SINGLETON(foo)
without causing a warning about an extra semicolon.
The extra semicolon helps some editors at parsing the C++ code.

svn-id: r54258
2010-11-16 08:23:13 +00:00
Thierry Crozat
4e357549d5 COMMON: Fix TranslationManager
Revision 54206 broke translations support because it uncovered a bug in
the TranslationManager when reading the translations.dat file. In that file
all the stored string lengths include the terminating 0 but Common::String
expect a length without the terminating 0. Therefore all String objects
created from reading the translations.dat file had an incorrect size. This
caused the font file names to be wrong after adding the charset.

svn-id: r54235
2010-11-13 23:27:13 +00:00
Johannes Schickel
c624202c39 COMMON: Fix compilation when translation support is disabled (regression from r54207).
svn-id: r54209
2010-11-11 19:20:26 +00:00
Max Horn
cc61445599 COMMON: Cleanup translation manager code; add FIXME
svn-id: r54206
2010-11-11 18:22:35 +00:00
Jordi Vilalta Prat
8388e0dfea JANITORAL: Clean trailing whitespaces.
svn-id: r53160
2010-10-12 02:18:11 +00:00
Thierry Crozat
1177692701 GUI: Fix bug #3075649 (Fonts not found with built-in theme)
When switching to a theme that do not have the fonts needed to properly
display the current language, it now revert to the previously used theme
and display an error message telling the user to change the language
first if he wants to use the theme he selected.

svn-id: r52969
2010-10-01 21:41:40 +00:00
Thierry Crozat
a2a3073562 I18N: Look for translations data file in Themes path
If the translations.dat file is not found using the SearchMan, it now looks
for that file into the themepath directory and sub-directories (if the path is
defined).

svn-id: r52428
2010-08-28 15:51:23 +00:00
Thierry Crozat
bc821136fd i18n: Add support for context in translations.
This change means there can now be different translations for the same
english string depending on the context. It is based on gettext msgctxt feature.
There is a new macro _c(msg, ctxt) that should be used instead of _(msg) in
the source code when we want to add a context to the message. For the
moment I have added contexts to only one message ("None") so that I could
test the changes. Context could be added also to get shorter translations when
GUI is in 1x mode.

I have also added back the fuzzy option to msmerge since it is useful when
adding contexts to populate the translations for the new contexts.

svn-id: r52308
2010-08-23 19:45:14 +00:00
Johannes Schickel
ff06f0c9d5 i18n: Changed wording of messages about translations.dat file.
svn-id: r52261
2010-08-21 14:05:38 +00:00
Johannes Schickel
7fd7689370 i18n: Formatting fixes.
svn-id: r52260
2010-08-21 13:38:08 +00:00
Johannes Schickel
a53d4dde66 i18n: Style fixes.
svn-id: r52257
2010-08-21 13:21:09 +00:00
Thierry Crozat
9015a14531 i18n: Fix previous commit when translation support is disabled
Previous commit of translation.cpp introduced a defined but not
implemented operator when the translation support was disabled.
This was probably fine since it was not used, but not very clean.

svn-id: r52241
2010-08-20 21:04:39 +00:00
Thierry Crozat
d00b8a5753 i18n: Sort the list of available languages alphabetically
svn-id: r52239
2010-08-20 20:42:13 +00:00
Eugene Sandulenko
040dfff8ce i18n: Move translations to standalone file. Patch #3044975
svn-id: r52208
2010-08-19 11:46:55 +00:00
Thierry Crozat
797012eb5c i18n: Fix link error when localization is disabled
This fix a regression introduced in revision 50448 ("Add support for
locale-dependant font'). When disabling localization a function was
declared, called but not implemented.

svn-id: r52048
2010-08-12 23:09:38 +00:00
Thierry Crozat
1c6b339bbc i18n: use user friendly language names in GUI
The GUI now uses the content of the Language field from the po file
header if it is present and not empty for the language selection
PopupWidget. If not present it uses the file name as before (e.g.
ru_RU).

Also update all the translation template and all the translation files.

svn-id: r51542
2010-07-31 15:46:43 +00:00
Johannes Schickel
e5e94d4511 Strip trailing whitespaces in our common code base.
svn-id: r51094
2010-07-21 18:17:51 +00:00
Eugene Sandulenko
0e7ccb896d i18n: Add support for locale-dependent fonts
Currently it ws not decided where to put fonts, but if you put BDF files into
themepath, they will get picked up.

The font name has to contain same codepage specification as in the .po file,
i.e. fixed5x8-iso-8859-5.bdf for Cyrillic codepage. In case the font does not
exist, default will be used.

All built in fonts get proper names.

TODO: Currently there is a bug with our font cacher. Font clR6x12-iso-8859-5
is empty after loading from FCC file. Reason is unknown.

svn-id: r50448
2010-06-28 15:17:10 +00:00
Johannes Schickel
4ec0827551 Add some explanation why we can not just use setlocale on Win32.
svn-id: r50354
2010-06-26 23:01:12 +00:00
Johannes Schickel
b7ab6ca3f1 Use "C" on Win32 as syslang in case the locale could not be determined.
svn-id: r50353
2010-06-26 22:51:13 +00:00
Johannes Schickel
14fdd11c04 Fix compilation with our default build system when USE_DETECTLANG is specified.
svn-id: r50349
2010-06-26 22:44:43 +00:00
Johannes Schickel
578cdb2aeb Implement support for auto detection of the users preferred locale on Windows.
Note that this might break support for Windows versions older than Win2k,
at least according to the MSVC docs GetLocaleInfo is only supported by Win2k+.

I added a comment about that though.

svn-id: r50348
2010-06-26 22:32:51 +00:00
Johannes Schickel
58fcda82f3 Remove support for translation of console messages.
In recent discussions on -devel it turned out, that this
feature is rather superfluous and instead we should rather
implement a proper error reporting in our GUI.

I also removed the dependency on iconv along with this.

svn-id: r50335
2010-06-26 18:07:41 +00:00
Torbjörn Andersson
38b172e8e5 Fixed some Cppcheck warnings. (There are plenty left, if anyone's wondering.)
svn-id: r50120
2010-06-21 19:32:25 +00:00
Johannes Schickel
d869d1370e Properly provide stub implementations for all TranslationManager methods when USE_TRANSLATIONS is not defined.
svn-id: r49997
2010-06-18 02:25:33 +00:00
David Turner
e5f609a40a Correction for Invalid reads in Translation iconv calls reported by Valgrind.
The string terminators were omitted from the iconv call and not restored.

svn-id: r49916
2010-06-17 03:22:52 +00:00
Johannes Schickel
49463c2bf9 Use USE_TRANSLATION, USE_DETECTLANG and USE_TERMCONV instead of (ENABLE_)TRANSLATION, DETECTLANG and TERMCONV.
svn-id: r49885
2010-06-15 19:20:58 +00:00
Johannes Schickel
a42ea73a76 Simplify code for the "ICONV_USES_CONST" case even more. (i.e. remove the "msg" variable there).
svn-id: r49880
2010-06-15 17:56:05 +00:00