19 Commits

Author SHA1 Message Date
Haoyu Qiu
8d93b6a54c Add translation preview in editor 2025-05-27 07:59:28 +08:00
Haoyu Qiu
bbc6643e4c Remove translation loading logic that was never used 2025-05-12 19:05:20 +08:00
A Thousand Ships
889410dcda
Add String::replace_char(s) methods for performance and convenience 2025-04-10 13:08:45 +02:00
Pāvels Nadtočajevs
c3921954f2
Fix editor layout direction change on translation change. 2025-03-27 17:35:21 +02:00
A Thousand Ships
466590d0ec
Use get_slicec instead of get_slice for single character splitters 2025-03-08 20:36:37 +01:00
Pāvels Nadtočajevs
9ae5f09c20 Fix editor UI showing empty string for unknown locales. 2025-02-13 08:07:26 +02:00
Pāvels Nadtočajevs
e9fd760357 Use fallback locale from project settings instead of hardcoded "en" for TextServer. 2025-02-10 08:55:50 +02:00
Rémi Verschelde
88e81ee730
Fix various typos and code style issues 2024-11-28 17:40:42 +01:00
Dan Nicholson
6f4fadf65d Expose standardize_locale add_default param publicly
Comparing locales can have surprising outcomes since it standardizes
locales with defaults. For example, zh and zh_CN result in an exact
match since the defaults change them both to zh_Hans_CN. Expose the
add_default parameter publicly with a default of false so the fully
standardized locale can be inspected.
2024-11-21 16:50:31 -07:00
Thaddeus Crews
ebf49317a2
Merge pull request #97923 from kisg/translation_server_siof_fix
Make TranslationServer singleton variable inline.
2024-11-12 12:13:01 -06:00
Dan Nicholson
2dd409fd70 Improve locale comparison
Since 9456454109, country specific locales are always preferred over
country-less locales even when the OS locale country doesn't match. For
example, running the Godot editor with locale es_ES will result in the
es_AR locale being chosen even though the es locale would be better.

The change happened because the score of the es_AR locale and the es
locale are the same when comparing to es_ES. Change this by parsing
locale strings into a Locale structure and decreasing the score when
script, country or variant are set in both but not matched. For the
es_ES case, this causes the es_AR score to be decreased since the
countries don't match. On the other hand, the es locale is not decreased
since it doesn't specify a country.
2024-11-12 06:06:50 -07:00
Haoyu Qiu
acab2d6c1c Cache results for TranslationServer.compare_locales() 2024-10-16 20:54:56 +08:00
Gergely Kis
257633c354 Make TranslationServer singleton variable inline.
This change avoids the problem known as 'Static Initialization Order Fiasco' (SIOF).

See the following PR for more explanation: https://github.com/godotengine/godot/pull/94683

Co-authored-by: Gabor Koncz <gabor.koncz@migeran.com>
2024-10-07 13:47:42 +02:00
Haoyu Qiu
cca54ba4db Move pseudolocalization into TranslationDomain
Also adds command-line option `--editor-pseudolocalization`
2024-09-21 18:28:12 +08:00
Haoyu Qiu
818acb4290 Make editor use translation domains
How editor plugins use this feature:
1. Pick a unique translation domain name.
2. `_enter_tree()`: load translations into that translation domain.
3. Call `set_translation_domain()` for its root UI node.
4. `_exit_tree()`: remove that translation domain.

Plugins can also set the translation domain to `godot.editor` for
nested nodes that should use editor translations. `EditorFileDialog`
automatically does this.
2024-09-17 13:09:44 +08:00
Haoyu Qiu
68d494e24e Add translation domain 2024-09-17 13:09:44 +08:00
rune-scape
0dde931bc9 StringName: Fix empty hash
+Fixed compat hashes
2024-09-09 13:30:02 -07:00
Pedro J. Estébanez
cfb7443e26 TranslationServer: Add fast path for comparison of equal locales 2024-09-02 10:50:14 +02:00
Haoyu Qiu
7343dc3a5d Split TranslationServer into its own file 2024-08-15 15:00:47 +08:00