Commit Graph

199 Commits

Author SHA1 Message Date
Juha
41adb276bb Remove obsolete checks for FPC versions earlier then 3.0. 2023-07-07 17:39:02 +03:00
Maxim Ganetsky
65ed61c3ba LazUtils: Make LazGetLanguageIDs and LazGetShortLanguageID procedures use results of GetLanguageID function from Translations unit. Also deprecate LazGetLanguageIDs and LazGetShortLanguageID. 2023-06-12 04:11:44 +03:00
Maxim Ganetsky
97c198b599 LazUtils: Remove special macOS handling from LazGetLanguageIDs procedure. Handle macOS just as any Unix.
For the record, the logic of this code was the following:
1. If the App Bundle does not do any Locale configuration, 'English' is
returned (i. e. not an ISO code).
2. If the App Bundle has configured the Locale configuration that
matches the user's system settings, it will return locale name from its
list, e. g. 'zh_CN'.
3. If the App Bundle cannot match the Locale of the user system, the
first item set in the App Bundle is returned (`en` in case of Lazarus).

So this code provided no tangible benefits and introduced dependency on
language list in Lazarus bundle. This list was outdated and thus
prevented autodetection of Czech, Hungarian, Brazilian Portuguese,
Ukrainian languages on macOS.

In case there will a need to reintroduce special macOS handling arise,
NSLocale.object() should be called with `countryCode` and `languageCode`
keys.
2023-06-11 20:10:26 +03:00
Maxim Ganetsky
e13533d1e1 LazUtils: merge LazTrimLanguageID to LazGetLanguageIDs, it is used only there now 2023-06-06 03:00:26 +03:00
Maxim Ganetsky
d05dd86b2c LazUtils: simplify LazGetShortLanguageID procedure logic
It actually wants to return FallbackLang, so just return it and do not
make any assumptions about its length.
2023-06-03 19:18:40 +03:00
Maxim Ganetsky
e7b16e08e4 LazUtils: improved newly added language ID trimming procedure name (LazGetTrimmedLanguageID -> LazTrimLanguageID) in order to signify that it only transforms passed ID value 2023-06-02 02:03:46 +03:00
Maxim Ganetsky
42bcafe228 LazUtils, LCL: Trim encoding from found language ID if it presents there (e. g. ru_RU.utf8) in order to always correctly load translation files like project1.ru_RU.po. Based on patch by ACTom, merge request !182. 2023-06-01 18:22:30 +03:00
Juha
ce9b92c95d LazUtils: Remove a deprecated procedure. 2023-02-26 20:44:14 +02:00
Juha
20d2044bb4 LazUtils: In UTF8CompareLatinTextFast, use AnsiCompareText instead of WideCompareText. 2022-12-02 22:45:14 +02:00
Bart
46e8e195a9 LazUtf8: fix UTF8CompareLatinTextFast to be consistent with Utf8CompareText, when comparing lower ASCII values. Issue #40014 2022-11-25 17:26:14 +01:00
Bart
c67c745669 LazUtf8: honour CaseSensitive in TStringListUTF8Fast.DoCompareText. 2022-11-23 14:23:20 +01:00
Bart
4b313d25b3 LazUtf8: optimize Utf8StringReplace. Issue ##39576. Do NOT merge to 2.2 fixes! 2022-01-22 18:32:41 +01:00
Bart
24bb2eb1a4 LazUtf8: small optimization of Utf8EscapeControlChars. 2022-01-22 14:55:25 +01:00
Bart
0ff1e5d2a7 LazUtf8: pass language string parameters as const. Patch by Alexey Torgashin. Issue ##39577 2022-01-22 14:25:35 +01:00
Bart
242f0ac056 LazUtf8: faster implementation Utf8EscapeControlChars based upon idea by Alexey Torgashin. Issue #39573. 2022-01-19 15:38:43 +01:00
Bart
18b5c2d3e2 LazUtf8: use PopCnt in Utf8LengthFast if instructionset supports it (currently X86 with -CpCOREI or higher). 2021-12-28 16:15:01 +01:00
Bart
71d44be64a LazUtf8: use unsigned variables in Utf8LengthFast. 2021-12-28 14:29:01 +01:00
Bart
153a562187 LazUtf8: fix rangecheck error due to not detecting invalid 4-byte Utf8-codepoint in ConvertUTF8ToUTF16. Issue #39501. 2021-12-11 19:17:44 +01:00
bart
7a69a2a702 LazUtf8: fix FindInvalidUtf8CodePoint for 3-byte encodings that encode for values reserved for UTF-16 surrogate halves.
git-svn-id: trunk@65246 -
2021-06-16 08:25:28 +00:00
maxim
6c7c5f4911 LazUtils: fixed typos related to 'occur' word
git-svn-id: trunk@65197 -
2021-06-10 22:10:27 +00:00
mattias
8396e2d0e0 lazutils: fixed ConvertUTF8ToUTF16 U+1FFFFF
git-svn-id: trunk@65182 -
2021-06-06 18:12:00 +00:00
mattias
63af733452 lazutils: fixed ConvertUTF8ToUTF16 U+1F600 and added tests
git-svn-id: trunk@65181 -
2021-06-06 17:50:54 +00:00
mattias
43ae6df320 lazutils: ConvertUTF8ToUTF16 and UTF8CodepointToUnicode check $10FFFF
git-svn-id: trunk@65166 -
2021-06-02 08:44:47 +00:00
mattias
6de8b92783 lazutils: UTF8FixBroken: fixing out of range and endless loop, added tests
git-svn-id: trunk@65163 -
2021-06-01 22:01:18 +00:00
mattias
c887c889e3 lazutils: FindInvalidUTF8Codepoint: check if bigger U+10FFFF
git-svn-id: trunk@65162 -
2021-06-01 21:02:23 +00:00
mattias
c54a8fa65a lazutils: less hints
git-svn-id: trunk@65012 -
2021-04-17 11:30:56 +00:00
juha
4c27531f6f LazUtils: Add function UTF8CompareTextP, use it in CompareFilenamesP.
git-svn-id: trunk@64391 -
2021-01-14 21:54:49 +00:00
juha
751852a44a LazUtils: New function UTF8CompareLatinTextFast. Use in IDE instead of UTF8CompareText.
git-svn-id: trunk@64385 -
2021-01-14 13:52:23 +00:00
juha
a9aa51a93d Tweak / optimization.
git-svn-id: trunk@64372 -
2021-01-10 19:07:46 +00:00
maxim
3d552017f1 LazUtils: commented out stray writeln, which was causing crashes on Windows after r64345 #865e21e88f
git-svn-id: trunk@64350 -
2021-01-08 00:43:07 +00:00
juha
865e21e88f LazUtils: Optimize UTF8CompareText when codepoints have one byte. Applies to most filename comparisons.
git-svn-id: trunk@64345 -
2021-01-07 13:43:47 +00:00
bart
f47a2a5fd6 LazUtils: Remove tests for FPC versions 2.x.
git-svn-id: trunk@64122 -
2020-11-11 14:03:48 +00:00
juha
4321fbf6e5 LazUtils: move procedure ReplaceSubstring from LazUTF8 to LazStringUtils.
git-svn-id: trunk@64081 -
2020-10-29 15:45:34 +00:00
bart
5812e23a64 LazUtf8: add some more C-escape strings for the Utf8EscapeControlChars function.
git-svn-id: trunk@64062 -
2020-10-24 10:03:39 +00:00
mattias
0eb446e94a lazutils: SysToUTF8: only UTF8_RTL, issue #35696, from Serge Anvarov
git-svn-id: trunk@61352 -
2019-06-10 16:19:00 +00:00
bart
642a3a9b68 LazUtils: change order of new Count parameter in Utf8StringReplace/Utf16StringReplace.
git-svn-id: trunk@60429 -
2019-02-15 15:52:00 +00:00
bart
c452fc00e6 LazUtils: add optional Count parameter to Utf8StringReplace/Utf16StringReplace.
git-svn-id: trunk@60426 -
2019-02-15 13:56:08 +00:00
juha
64a3cced51 LazUtils: Added inlines to some functions in LazUTF8. Issue #34472, patch from AlexeyT.
git-svn-id: trunk@59394 -
2018-10-30 11:04:21 +00:00
juha
c9e4614e17 Delete old deprecated methods.
git-svn-id: trunk@59175 -
2018-09-28 11:06:40 +00:00
bart
70f0e3209a LazUtf8: leftpad escaped characters in Utf8EscapeControlChars if EscapeMode = emPascal. Prevents ambiguity when reading the result.
git-svn-id: trunk@59125 -
2018-09-22 09:57:01 +00:00
juha
ed1cd9335d LazUtils: Add a new function UTF8ProperCase() to unit LazUTF8.
git-svn-id: trunk@56892 -
2017-12-31 08:49:05 +00:00
juha
f8be53b0e6 LazUtils: Change "Character" to "Codepoint" also in some parameter names in LazUTF8. Cleanup.
git-svn-id: trunk@56708 -
2017-12-13 00:07:00 +00:00
juha
6810c626df LazUtils: Change "Character" to "Codepoint" in LazUTF8 function names to be more accurate and to avoid confusion.
git-svn-id: trunk@56692 -
2017-12-11 19:44:22 +00:00
mattias
8fa91fbd06 lazutf8: fixed UTF8LowerCase CIRCLED LATIN CAPITAL LETTER K
git-svn-id: trunk@56665 -
2017-12-07 19:43:10 +00:00
juha
be0dcc0b50 LazUtils: Fix errors in LazUTF8.UTF8LowerCase. By forum user Munair.
git-svn-id: trunk@56662 -
2017-12-07 15:54:54 +00:00
juha
962f0fce09 LazUtils: Improve function UTF8LengthFast. From forum user "engkin".
git-svn-id: trunk@56572 -
2017-12-01 13:54:45 +00:00
juha
d10aed499e LazUtils: Improve function UTF8RPos. Use RPos and UTF8Length instead of reversing the whole string.
git-svn-id: trunk@56529 -
2017-11-28 21:29:05 +00:00
mattias
90dd28d142 lazutils: simplified
git-svn-id: trunk@56163 -
2017-10-23 09:35:35 +00:00
mattias
6e41e1e216 lazutils: fixed UTF8CharacterLengthFast
git-svn-id: trunk@55218 -
2017-06-04 20:18:38 +00:00
juha
e27232d4cc Fix uninitialized variables based on compiler warnings got with dfa (data flow analysis) enabled.
git-svn-id: trunk@55211 -
2017-06-04 15:14:29 +00:00