Commit Graph

579 Commits

Author SHA1 Message Date
Lukas Tenbrink
1f6f4b622e Fix the NodePath hash function to not yield the same value for similar paths.
(cherry picked from commit a6e952c1604963023a87c07093cc9b24e6d6591d)
2026-02-05 09:46:06 -06:00
Fabio Alessandrelli
65ce1360b4 network: Normalize IP parsing, fix IPv6, tests 2026-01-13 18:55:55 +01:00
Rémi Verschelde
30c2fc148e Merge pull request #113575 from bruvzg/fix_path
[Unix] Remove leading `..` from absolute paths and apply `simplify_path` to Unix current directory path.
2025-12-18 14:23:59 +01:00
Pāvels Nadtočajevs
997f326b58 Improve language selection when shaping text. 2025-12-18 09:05:07 +02:00
Pāvels Nadtočajevs
6c6c184c32 [Unix] Remove leading .. from absolute paths and apply simplify_path to Unix current directory path. 2025-12-04 20:15:26 +02:00
Thaddeus Crews
66333f9d92 Merge pull request #113322 from nikitalita/fix-translation
Fix loading old-style translation files
2025-12-03 16:50:35 -06:00
Thaddeus Crews
51d5a17055 Merge pull request #113447 from TokageItLab/opt-nodepath
Optimize NodePath
2025-12-02 11:51:58 -06:00
Pāvels Nadtočajevs
a9ef3e5804 Fix duplicate minus in print output.
Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2025-12-02 18:58:55 +02:00
Silc Lizard (Tokage) Renew
b97aa0ba3c Optimization NodePath
co-authored-by: Ryan-000 <73148864+Ryan-000@users.noreply.github.com>
2025-12-02 21:45:35 +09:00
nikitalita
349b61cb14 Fix loading old-style translation files 2025-11-29 10:22:46 -05:00
Yarvin
364e98afc5 Fix String::rfindn for strings with only one character.
----

Remove optimization – no need to introduce extra complexity for
negligible (if any) gains.
2025-11-22 16:52:55 +01:00
Haoyu Qiu
ec860ffe4a Add methods for querying loaded Translation instances 2025-11-21 08:51:26 +08:00
Lukas Tenbrink
43a8009a56 Clean up String::find to remove duplicate code, and speed up comparison with memcmp where possible. 2025-11-19 22:39:05 +01:00
Haoyu Qiu
04ac5cbb89 Prevent the main locale from being set to an empty string 2025-11-18 10:07:35 +08:00
kobewi
e14263f917 Remove empty constructors and destructors from core/ 2025-11-17 20:09:05 +01:00
Thaddeus Crews
910133fda6 Merge pull request #104280 from Ivorforce/span-equality
Add `Span` equality (`==` and `!=`) operators.
2025-11-17 10:56:55 -06:00
Lukas Tenbrink
d7f5c13db8 Add Span equality (== and !=) operators.
Exchange duplicate equality iteration implementations across `Vector` and `String` with the `Span` version, for a speed boost.
2025-11-15 14:21:54 +01:00
Haoyu Qiu
43e323dce5 Remove TranslationPO 2025-11-15 10:13:07 +08:00
Thaddeus Crews
8327dfa215 Merge pull request #112092 from timothyqiu/ts-nums
Move localized number formatting methods to `TranslationServer`
2025-11-10 17:47:09 -06:00
Thaddeus Crews
9ac55bcc7f Merge pull request #112415 from timothyqiu/project-name-localized
Allow localizing the application name with project translations
2025-11-10 08:20:00 -06:00
Thaddeus Crews
32242dbe4d Merge pull request #112026 from timothyqiu/plural-default
Use more practical default plural rules
2025-11-10 08:19:58 -06:00
Haoyu Qiu
72d437c030 Move localized number formatting methods to TranslationServer
Co-Authored-By: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com>
2025-11-10 15:01:22 +08:00
Haoyu Qiu
b8a8f8b35a Allow localizing the application name with project translations 2025-11-08 13:06:55 +08:00
Thaddeus Crews
0d89d2fb82 Merge pull request #112149 from timothyqiu/csv-template
Add CSV translation template generation
2025-11-04 16:32:26 -06:00
Thaddeus Crews
ae9732139a Merge pull request #109433 from KoBeWi/hastension
Add `has_extension()` method to String
2025-10-31 09:23:30 -05:00
Haoyu Qiu
ea9a2c3b2c Add CSV translation template generation 2025-10-30 08:44:41 +08:00
Haoyu Qiu
c1ee8e52e4 Improve CSV translations
- Adds context and plural support
- Adds unescape import options
- Better document OptimizedTranslation

Co-Authored-By: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com>
2025-10-27 17:47:45 +08:00
Haoyu Qiu
d180b9af9f Use more practical default plural rules 2025-10-25 15:50:20 +08:00
Thaddeus Crews
06bdfa5a16 Merge pull request #110478 from beicause/opt-node-path-to-string
Optimize NodePath to String by using cached path
2025-10-23 11:03:53 -05:00
Thaddeus Crews
20430236e7 Merge pull request #107999 from timothyqiu/translation-cleanup
Clean up editor translation related methods
2025-10-15 16:31:09 -05:00
Thaddeus Crews
49219de402 Merge pull request #108862 from timothyqiu/plural-rules
Move context and plural support to `Translation`
2025-10-15 16:31:07 -05:00
Lukas Tenbrink
839e0358b3 Assert that dictionary.h does not include String, and that neither of the fundamental containers include Object. 2025-10-06 23:03:27 +02:00
Thaddeus Crews
f1f9f54ac3 Merge pull request #111244 from Ivorforce/dont-include-array
Remove `Array` include from `dictionary.h` and `ustring.h`.
2025-10-06 14:34:10 -05:00
Lukas Tenbrink
dc5e615a1d Remove Array include from dictionary.h and ustring.h. 2025-10-06 16:21:36 +02:00
Thaddeus Crews
5935a32e32 Core: Cleanup headers in core/config
- `MainLoop` now forward-declared in `OS`
2025-10-06 09:20:56 -05:00
Thaddeus Crews
d1d28c0bcf Merge pull request #111223 from Ivorforce/remove-iterator-include
Replace `std::size` usage with `std_size` to avoid `<iterator>` include.
2025-10-06 09:06:49 -05:00
Thaddeus Crews
d8df20a2e6 Merge pull request #110932 from Ivorforce/string-buffer-size-comment
Add comments to `String::size` to lead people to `length()` and explain the difference.
2025-10-06 09:06:40 -05:00
Lukas Tenbrink
ad600125df Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
Remove cross-project includes from `hashfuncs.h`.
Improve hashing function for `Color` (based on values instead of `String`).
Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used.
Remove now unnecessary `HashableHasher`.
2025-10-05 01:49:11 +02:00
Lukas Tenbrink
1db0a60dc0 Replace std::size usage with std_size to avoid <iterator> include. 2025-10-05 00:26:11 +02:00
Lukas Tenbrink
712bc99668 Add STATIC_ASSERT_INCOMPLETE_TYPE to enforce include minimality.
Add enforcements against `Dictionary` for `ustring.h` and two for `Dictionary` and `String` from `array.h`.
2025-10-01 23:46:35 +02:00
Lukas Tenbrink
bac9a9be85 Add comments to String::size to lead people to length() and explain the difference.
# Conflicts:
#	core/string/ustring.h
2025-10-01 12:08:37 +02:00
Thaddeus Crews
62933b683e Merge pull request #105928 from Ivorforce/cowdata-reserve-capacity
Core: Add `reserve` function to `Array`, `Vector`, and `String`
2025-09-30 11:19:13 -05:00
Thaddeus Crews
f6fc2f4a08 Core: Remove skip_cr argument from String 2025-09-28 10:07:24 -05:00
Haoyu Qiu
4e80190a46 Move context and plural support to Translation
- `TranslationPO` is now an empty class. It exists for compatibility.
- `OptimizedTranslation` stays the same, no context or plural support.
2025-09-26 10:51:57 +08:00
Haoyu Qiu
e882e42e1b Add default plural rules
This makes the PO loader correctly handle the situation where the optional
`Plural-Forms` header field does not exist.

The `Translation` class and its subclasses always have access to valid plural
rules via `_get_plural_rules()`. Plural rules are prioritized:

1. `Translation.plural_rules_override`
2. `TranslationServer.get_plural_rules(locale)`
3. The English plural rules: `nplurals=2; plurals=(n != 1)`

Co-Authored-By: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com>
2025-09-26 10:51:57 +08:00
Haoyu Qiu
ebb96e2303 Move plural rules logic into a separate class
- Extracts plural rules logic in `TranslationPO` into a new `PluralRules` class.
- Changes caching the last used plural index in `TranslationPO` into an LRU cache in `PluralRules`.
- Adds tests for `PluralRules`.
2025-09-26 10:51:55 +08:00
Lukas Tenbrink
1bf821c1e1 Store current capacity in CowData buffers, and rewrite most of it.
Add `reserve` to `CowData`, `Vector` and `Array`.

# Conflicts:
#	core/os/memory.h
#	core/templates/cowdata.h
2025-09-25 22:00:17 +02:00
Edward Moulsdale
e366471fdc Add GDSOFTCLASS to deeper inheritors of Object 2025-09-24 19:15:56 +01:00
Lukas Tenbrink
c6f57c7a55 Change "reserve called with a capacity smaller than the current size" error message to a verbose message. 2025-09-23 20:02:40 +02:00
Thaddeus Crews
9b7a723aac Merge pull request #107721 from YYF233333/ps_include
Remove dependency of `variant.h` in `print_string.h`
2025-09-22 08:50:04 -05:00