Commit Graph

86 Commits

Author SHA1 Message Date
Thierry Crozat
32d4173fda COMMON: Remove unused and useless getCurrentCharset in TransMan
Now all translations use unicode.
2021-10-02 23:50:21 +01:00
Thierry Crozat
ebd8915009 GUI: Simplify builtin language check 2021-10-02 23:50:21 +01:00
Thierry Crozat
cbb627a40b COMMON: Change TransMan builtin language to "en" instead of "C" 2021-08-04 19:28:47 +01:00
Vladimir Serbinenko
0d39e96f55 COMMON: Make TranslationManager reusable.
This makes it possible to reuse TranslationManager with different
files.
2020-12-17 09:49:18 +01:00
Zvika Haramaty
606eeae46f COMMON: move convertBiDiString out of TranslationManager 2020-11-04 22:27:24 +00:00
Zvika Haramaty
542a3378d3 I18N: Always call BiDi algorithm for U32String
U32String can contain characters from all languages, without relation
to the GUI's language. Therefore, we need to always call it.

Use case:
In Hebrew SQ3, when using the game's original save/restore dialogs, it's
possible to give save games Hebrew names.
What happens when we then use ScummVM's load dialog?
- If ScummVM's GUI language is Hebrew, it's calling BiDI algo, and
  the text direction is OK.
- However, if ScummVM's GUI language is English, before this commit it
  didn't call the BiDI algo, and the text was reversed.
2020-11-04 22:27:24 +00:00
Thierry Crozat
186e6142a0 COMMON: Remove unused functions in TranslationManager
There were leftovers from the transition to U32String.
2020-10-30 22:54:09 +00:00
Thierry Crozat
927127abd5 I18N: Support having unicode characters in language names 2020-09-02 12:08:49 +02:00
aryanrawlani28
22ef76638c GUI: U32: Return visual from convertBiDiU32String 2020-08-30 14:43:41 +02:00
aryanrawlani28
b6278f3400 GUI: U32: Write translation description and size for english language also as uint32BE.
All blocks of sizes are now written in uint32BE.
2020-08-30 14:43:41 +02:00
aryanrawlani28
9573f1e515 GUI: U32: Remove useless check when converting bidiString 2020-08-30 14:43:41 +02:00
aryanrawlani28
3d97be2559 GUI: U32: Remove redundant code
Because po files now (should) use UTF-8, a bunch of code in ScummVM is redundant. This commit addresses that.

- Remove charsetMapping and related variables.
- Remove the code that used these functions.
- Remove cp_parser.cpp. This is removed because the use of codepages is no longer needed.
- Remove iso-8859-x codepages (see above message)
- Always set mapping as 0 in ThemeEngine::loadScalableFont
- Check if ascii or not by getting charset in about dialog.
2020-08-30 14:43:41 +02:00
aryanrawlani28
810b7cfccc GUI: U32: Write block sizes as Uint32BE
- Changes made in create_translations tool and translations.cpp
- After converting po files to UTF-8, length of block did not fit in 16 bits. This commit addresses that.
2020-08-30 14:43:41 +02:00
aryanrawlani28
fc91436ea6 GUI: U32: Remove charsets being written to .dat 2020-08-30 14:43:41 +02:00
aryanrawlani28
6747e354b8 GUI: U32: Load translation info correctly 2020-08-30 14:43:41 +02:00
aryanrawlani28
dc1c82b74e GUI: U32: Define new translation version "4" 2020-08-30 14:43:41 +02:00
aryanrawlani28
085f375c98 GUI: U32: Store messages as U32Strings and remove codepages reading from .dat
- The previous commit removes all codepage additions to the create_translations tool.
- Following that, this commit removes all the reading from .dat file related to codepages
2020-08-30 14:43:41 +02:00
aryanrawlani28
a9bfe35216 GUI: U32: More issue fixes and general improvements
- Use the fake constructor for message dialog less often
- solve errors regarding comparision between string and u32string in midi
- solve errors in testbed/speech related to ttsMan->say
- fix unsigned comparision warning in tab.cpp
- fix issue with static strings and translations in sdl-graphics
2020-08-30 14:43:41 +02:00
aryanrawlani28
b9a449480b GUI: U32: Remove u32::format references
- Removed because implicit conversion can simply handle this usecase
2020-08-30 14:43:41 +02:00
aryanrawlani28
f800ca4ada GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes.

- Return U32String from TransMan getTranslation()
- Change tooltips to be U32Strings
- Remove temporary code of convertToU32String
- U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc)
- U32 for music plugins
- U32 for OSD messages
- Add some helper functions to ustr.cpp
- Change default tooltips from nullptr & 0 -> ""
- Some runtime exceptions may occur when changing languages due to incorrect String::Format
2020-08-30 14:43:41 +02:00
aryanrawlani28
2745d51fe7 GUI: U32: make convertBidiString take in and return u32strings 2020-08-30 14:43:41 +02:00
Zvika Haramaty
1f9d421558 COMMON: moved convertBiDiString(..lang) to unicode-bidi.h
Continuing the work at https://github.com/scummvm/scummvm/pull/2236,
which moved `convertBiDiString(..page)` to unicode-bidi.h,
now moving to there also the `(..lang)` flavour.

Thus, translation.h has only the SVM-GUI related function, and the
two util functions page+code are in unicode-bidi.
2020-05-19 12:32:58 +02:00
BLooperZ
ec83715b43 COMMON: add UnicodeBiDiText wrapper 2020-05-12 14:36:09 +02:00
BLooperZ
5b2bc4a9d3 COMMON: move bidi conversion to str-bidi.h 2020-05-12 14:36:09 +02:00
BLooperZ
c30b22c628 COMMON: add bidi support for U32String 2020-05-12 14:36:09 +02:00
Zvika Haramaty
1b8f471c69 GUI: Added (partial) BiDI support
Added GNU FriBidi, thus allowing Hebrew (or other future RTL languages)
to be displayed correctly.
It's been implemented for all ScummVM GUI (as far as I have noticed),
and can be further used by the engines as needed.

This work is only partial, because for complete BiDI support we'll need
to mirror the widgets, and support input text areas (which currently
don't even support Hebrew text input at all).

Some changes are required in order to use this:
- Visual Studio:
  -- add FriBidi lib from https://github.com/ShiftMediaProject/fribidi
     (and place the files in the other libs location)
  -- add fribidi.dll to the current directory
  -- add fribidi.lib to VS library list
     (in GUI it's: Project -> scummvm Properties -> Linker ->
                   input -> Additional Dependencies)
  -- Add USE_FRIBIDI define
     either to:
         dists/msvc/ScummVM_Global.props   <PreprocessorDefinitions>
     or in GUI:
         Project -> scummvm Properties ->
         C/C++ -> Preprocessor -> Preprocessor Definitions
- GCC:
  -- install FriBidi
     e.g.,
        Ubuntu: `apt-get install libfribidi-dev`
        CentOS: `yum install fribidi-devel`
  -- rerun `configure`
2020-04-30 10:32:18 +02:00
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