Skip to content

Commit dccb04a

Browse files
committed
Rework loadL10N method.
Changelog excerpt: - Reworked the loadL10N method, how it handles HTTP_ACCEPT_LANGUAGE, improved rule assignment, added some assumptions for supported L10N, and added the ability to defer non-supported L10N to supported L10N where sufficiently similar to be acceptable.
1 parent 8a43c32 commit dccb04a

33 files changed

+105
-70
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,5 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
115115
[2023.03.24; New Feature; Maikuolan]: Added the ability to log outbound requests.
116116

117117
[2023.03.31; Maikuolan]: Eliminated a low-risk potential performance bottleneck at the loadL10N method.
118+
119+
[2023.04.01; Maikuolan]: Reworked the loadL10N method, how it handles HTTP_ACCEPT_LANGUAGE, improved rule assignment, added some assumptions for supported L10N, and added the ability to defer non-supported L10N to supported L10N where sufficiently similar to be acceptable.

assets/config.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Configuration defaults file (last modified: 2023.03.24).
10+
# This file: Configuration defaults file (last modified: 2023.04.01).
1111
##/
1212

1313
core:
@@ -144,10 +144,10 @@ core:
144144
type: "string"
145145
default: "en"
146146
choices:
147-
en: "English"
148147
ar: "العربية"
149148
bn: "বাংলা"
150149
de: "Deutsch"
150+
en: "English"
151151
es: "Español"
152152
fa: "فارسی"
153153
fr: "Français"
@@ -174,6 +174,42 @@ core:
174174
zh: "中文(简体)"
175175
zh-TW: "中文(傳統)"
176176
choice_filter: "filterL10N"
177+
defer:
178+
en-GB: "en-AU"
179+
en-NZ: "en-AU"
180+
en-SG: "en-AU"
181+
en-ZA: "en-AU"
182+
zh-HK: "zh-TW"
183+
zh-MO: "zh-TW"
184+
zh-SG: "zh-CN"
185+
assume:
186+
bn: "bn-BD"
187+
de: "de-DE"
188+
en: "en-AU"
189+
es: "es-ES"
190+
fa: "fa-IR"
191+
fr: "fr-FR"
192+
he: "he-IL"
193+
hi: "hi-IN"
194+
id: "id-ID"
195+
it: "it-IT"
196+
ja: "ja-JP"
197+
ko: "ko-KR"
198+
lv: "lv-LV"
199+
ms: "ms-MY"
200+
nl: "nl-NL"
201+
no: "no-NO"
202+
pl: "pl-PL"
203+
pt: "pt-PT"
204+
ru: "ru-RU"
205+
sv: "sv-SE"
206+
ta: "ta-IN"
207+
th: "th-TH"
208+
tr: "tr-TR"
209+
uk: "uk-UA"
210+
ur: "ur-PK"
211+
vi: "vi-VN"
212+
zh: "zh-CN"
177213
lang_override:
178214
type: "bool"
179215
default: true

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"require": {
1414
"php": ">=7.2.0",
15-
"maikuolan/common": "^2.9",
15+
"maikuolan/common": "^2.9.6",
1616
"ext-pcre": "*"
1717
},
1818
"suggest": {

l10n/ar.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Arabic language data (last modified: 2022.08.18).
10+
# This file: Arabic language data (last modified: 2023.04.01).
1111
#
1212
# Regarding translations: My native language is English. Because this is a free
1313
# and open-source hobby project which generates zero income, and translatable
@@ -24,7 +24,6 @@
2424
# requests, ask. I can help.
2525
##/
2626

27-
Text Direction: "rtl"
2827
SafeBrowseLookup_200: "يحتمل أن تكون ضارة URL الكشف"
2928
SafeBrowseLookup_400: "API خطأ طلب"
3029
SafeBrowseLookup_401: "API خطأ ترخيص"

l10n/bn.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Bangla language data (last modified: 2022.08.18).
10+
# This file: Bangla language data (last modified: 2023.04.01).
1111
#
1212
# Regarding translations: My native language is English. Because this is a free
1313
# and open-source hobby project which generates zero income, and translatable
@@ -24,7 +24,6 @@
2424
# requests, ask. I can help.
2525
##/
2626

27-
Text Direction: "ltr"
2827
SafeBrowseLookup_200: "সম্ভাব্য ক্ষতিকারক URL সনাক্ত হয়েছে"
2928
SafeBrowseLookup_400: "API অনুরোধ ত্রুটি"
3029
SafeBrowseLookup_401: "API অনুমোদন ত্রুটি"

l10n/de.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: German language data (last modified: 2022.09.22).
10+
# This file: German language data (last modified: 2023.04.01).
1111
#
1212
# Regarding translations: My native language is English. Because this is a free
1313
# and open-source hobby project which generates zero income, and translatable
@@ -24,7 +24,6 @@
2424
# requests, ask. I can help.
2525
##/
2626

27-
Text Direction: "ltr"
2827
SafeBrowseLookup_200: "Potentiell schädliche URL entdeckt"
2928
SafeBrowseLookup_400: "API-Anforderungsfehler"
3029
SafeBrowseLookup_401: "API-Berechtigungsfehler"

l10n/en.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: English language data (last modified: 2022.08.18).
10+
# This file: English language data (last modified: 2023.04.01).
1111
#
1212
# Regarding translations: My native language is English. Because this is a free
1313
# and open-source hobby project which generates zero income, and translatable
@@ -24,7 +24,6 @@
2424
# requests, ask. I can help.
2525
##/
2626

27-
Text Direction: "ltr"
2827
SafeBrowseLookup_200: "Potentially harmful URL detected"
2928
SafeBrowseLookup_400: "API request error"
3029
SafeBrowseLookup_401: "API authorisation error"

l10n/es.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Spanish language data (last modified: 2022.08.18).
10+
# This file: Spanish language data (last modified: 2023.04.01).
1111
#
1212
# Regarding translations: My native language is English. Because this is a free
1313
# and open-source hobby project which generates zero income, and translatable
@@ -24,7 +24,6 @@
2424
# requests, ask. I can help.
2525
##/
2626

27-
Text Direction: "ltr"
2827
SafeBrowseLookup_200: "URL potencialmente dañino detectado"
2928
SafeBrowseLookup_400: "Error de solicitud de la API"
3029
SafeBrowseLookup_401: "Error de autorización de la API"

l10n/fa.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Farsi language data (last modified: 2022.08.18).
10+
# This file: Farsi language data (last modified: 2023.04.01).
1111
#
1212
# Regarding translations: My native language is English. Because this is a free
1313
# and open-source hobby project which generates zero income, and translatable
@@ -24,7 +24,6 @@
2424
# requests, ask. I can help.
2525
##/
2626

27-
Text Direction: "rtl"
2827
SafeBrowseLookup_200: "URL بالقوه مضر شناسایی شد"
2928
SafeBrowseLookup_400: "خطای درخواست API"
3029
SafeBrowseLookup_401: "خطای مجوز API"

l10n/fr.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: French language data (last modified: 2022.08.18).
10+
# This file: French language data (last modified: 2023.04.01).
1111
#
1212
# Regarding translations: My native language is English. Because this is a free
1313
# and open-source hobby project which generates zero income, and translatable
@@ -24,7 +24,6 @@
2424
# requests, ask. I can help.
2525
##/
2626

27-
Text Direction: "ltr"
2827
SafeBrowseLookup_200: "URL potentiellement nuisible détecté"
2928
SafeBrowseLookup_400: "Erreur de requête de l'API"
3029
SafeBrowseLookup_401: "Erreur d'autorisation de l'API"

0 commit comments

Comments
 (0)