From d078e45fb0619fb57e6840ef8456ce0f3e0da546 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Mon, 18 Mar 2024 23:50:50 +0100 Subject: [PATCH 01/21] Add getOSLanguage proposal --- proposals/i18n-getOSLanguage.md | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 proposals/i18n-getOSLanguage.md diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md new file mode 100644 index 00000000..37130f3f --- /dev/null +++ b/proposals/i18n-getOSLanguage.md @@ -0,0 +1,74 @@ +# Proposal: i18n.getOSLanguage> + +**Summary** + +Allow to get the language of your operating system as an `IETF tag` + +**Document Metadata** + +**Author:** carlosjeurissen + +**Created:** 2024-03-18 + +**Related Issues:** https://github.com/w3c/webextensions/issues/252 + +## Motivation + +### Objective + +As browsers often do not directly use the OS language but some reflection of it based on what languages are supported by the browser UI. + +#### Use Cases + +Having the original OS language is useful for language-related extensions and for extensions who want to provide translations more true to the OS language. For example, to adapt to a specific sub-language, like Belgium-Dutch (nl-BE). While i18n.getUILanguage would return 'nl'. + +### Known Consumers + +Language-related extensions and extensions wanting to match the language of the OS more closely independent of the langauge of the browser. + +## Specification + +### Schema + +`i18n.getOSLanguage()` would synchronously return an IETF tag just like `i18n.getUILanguage()` does right now. + +It would follow the following signature for [i18n.json](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/extensions/common/api/i18n.json): + + +```json +{ + "name": "getOSLanguage", + "type": "function", + "nocompile": true, + "description": "Gets the UI language of the Operating System. This is different from $(ref:i18n.getUILanguage) which returns the UI language of the web browser.", + "parameters": [], + "returns": { + "type": "string", + "description": "An IETF BCP 47 language tag such as en-US or pt-BR." + } +} +``` + +### New Permissions + +As browser.i18n.getUILanguage does not require a permission. browser.i18n.getOSLanguage also should not. + +### Manifest File Changes + +No new manifest fields + +## Security and Privacy + +### Exposed Sensitive Data + +The language of the OS will be purposely exposed. + +## Alternatives + +### Existing Workarounds + +There is no current workaround. + +### Open Web API + +To combat fingerprinting, this should not be an Open Web API. Just like browser.i18n.getUILanguage is not. From 7ed4c53adeb99fb6a0431c7d63973cd4cc6b2d6f Mon Sep 17 00:00:00 2001 From: carlosjeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:09:21 +0100 Subject: [PATCH 02/21] Update proposals/i18n-getOSLanguage.md Co-authored-by: rdcronin --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 37130f3f..05182016 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -71,4 +71,4 @@ There is no current workaround. ### Open Web API -To combat fingerprinting, this should not be an Open Web API. Just like browser.i18n.getUILanguage is not. +To combat fingerprinting, this should not be an Open Web API, just like browser.i18n.getUILanguage is not. From 916f91d8f75362a007240d0bd02a5ea9eb1f6884 Mon Sep 17 00:00:00 2001 From: carlosjeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:09:58 +0100 Subject: [PATCH 03/21] Update proposals/i18n-getOSLanguage.md Co-authored-by: rdcronin --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 05182016..41227fdc 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -51,7 +51,7 @@ It would follow the following signature for [i18n.json](https://chromium.googles ### New Permissions -As browser.i18n.getUILanguage does not require a permission. browser.i18n.getOSLanguage also should not. +As `browser.i18n.getUILanguage()` does not require a permission, browser.i18n.getOSLanguage also should not. ### Manifest File Changes From 30fbed65decde8dea4b859611e20ccfe256950e1 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:18:45 +0100 Subject: [PATCH 04/21] Update workaround description --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 41227fdc..76b354d6 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -67,7 +67,7 @@ The language of the OS will be purposely exposed. ### Existing Workarounds -There is no current workaround. +Currently, if an extension wants to offer languages outside of what the current browser language uses, it must do so by presenting a user-facing options page. However, currently there is no way to reasonably detect a language code outside of the browser's UI language with existing APIs. ### Open Web API From 133905657d7ca6cf40c6cb309b888192134a1c2a Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:19:08 +0100 Subject: [PATCH 05/21] Add back Sponsoring Browser with TBD --- proposals/i18n-getOSLanguage.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 76b354d6..79700c95 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -8,6 +8,8 @@ Allow to get the language of your operating system as an `IETF tag` **Author:** carlosjeurissen +**Sponsoring Browser:** TBD + **Created:** 2024-03-18 **Related Issues:** https://github.com/w3c/webextensions/issues/252 From b7781f432da67ba52533e88aca525051d1df351e Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:19:48 +0100 Subject: [PATCH 06/21] Add Bugzilla bug to related issues --- proposals/i18n-getOSLanguage.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 79700c95..4b46e09f 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -12,7 +12,9 @@ Allow to get the language of your operating system as an `IETF tag` **Created:** 2024-03-18 -**Related Issues:** https://github.com/w3c/webextensions/issues/252 +**Related Issues:** +https://github.com/w3c/webextensions/issues/252 +https://bugzilla.mozilla.org/show_bug.cgi?id=1888486 ## Motivation From ae8e4e222dba1b66771b17bd87c593dbf4331330 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:21:27 +0100 Subject: [PATCH 07/21] Add Author GitHub link --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 4b46e09f..4fbf730e 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -6,7 +6,7 @@ Allow to get the language of your operating system as an `IETF tag` **Document Metadata** -**Author:** carlosjeurissen +**Author:** [carlosjeurissen](https://github.com/carlosjeurissen) **Sponsoring Browser:** TBD From 0c352e8a97b708dbd57227ac3d00e33af499807e Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:25:16 +0100 Subject: [PATCH 08/21] Add bcp47 link --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 4fbf730e..c13bfce8 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -34,7 +34,7 @@ Language-related extensions and extensions wanting to match the language of the ### Schema -`i18n.getOSLanguage()` would synchronously return an IETF tag just like `i18n.getUILanguage()` does right now. +`i18n.getOSLanguage()` would synchronously return an [IETF tag](https://www.w3.org/International/core/langtags/rfc3066bis.html) just like `i18n.getUILanguage()` does right now. It would follow the following signature for [i18n.json](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/extensions/common/api/i18n.json): From 15fde778f0399ece1c5c469adb54eab890c348cf Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:27:13 +0100 Subject: [PATCH 09/21] Rephrase objective --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index c13bfce8..5a9222e1 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1888486 ### Objective -As browsers often do not directly use the OS language but some reflection of it based on what languages are supported by the browser UI. +Allow extensions to display UI in the user's system language, even when this is distinct from the browser's UI language (which is restricted to languages supported by the browser). #### Use Cases From 1bf297cc57a2fb4672d6d4c6871e7f10cc24b27f Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Sat, 30 Mar 2024 19:33:18 +0100 Subject: [PATCH 10/21] Rename IETF tags to BCP47 language tags --- proposals/i18n-getOSLanguage.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 5a9222e1..262b556a 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -2,7 +2,7 @@ **Summary** -Allow to get the language of your operating system as an `IETF tag` +Allow to get the language of your operating system as an [BCP47 language tag](https://www.w3.org/International/core/langtags/rfc3066bis.html). **Document Metadata** @@ -34,7 +34,7 @@ Language-related extensions and extensions wanting to match the language of the ### Schema -`i18n.getOSLanguage()` would synchronously return an [IETF tag](https://www.w3.org/International/core/langtags/rfc3066bis.html) just like `i18n.getUILanguage()` does right now. +`i18n.getOSLanguage()` would synchronously return a [BCP47 language tag](https://www.w3.org/International/core/langtags/rfc3066bis.html) like `i18n.getUILanguage()` does right now. It would follow the following signature for [i18n.json](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/extensions/common/api/i18n.json): @@ -48,7 +48,7 @@ It would follow the following signature for [i18n.json](https://chromium.googles "parameters": [], "returns": { "type": "string", - "description": "An IETF BCP 47 language tag such as en-US or pt-BR." + "description": "A BCP47 language tag such as en-US or pt-BR." } } ``` @@ -75,4 +75,4 @@ Currently, if an extension wants to offer languages outside of what the current ### Open Web API -To combat fingerprinting, this should not be an Open Web API, just like browser.i18n.getUILanguage is not. +To combat fingerprinting, this should not be an Open Web API, like browser.i18n.getUILanguage is not. From b9ab150182cfd797eb6933455f96dcf329a5c9d9 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Sun, 31 Mar 2024 10:17:20 +0200 Subject: [PATCH 11/21] Remove > from title --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 262b556a..1a67aea4 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -1,4 +1,4 @@ -# Proposal: i18n.getOSLanguage> +# Proposal: i18n.getOSLanguage **Summary** From da34a81875d7288c94b6e0bd2a6effcdda4cfcaa Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Sun, 31 Mar 2024 10:19:00 +0200 Subject: [PATCH 12/21] Replace chromium source reference with a permalink --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 1a67aea4..d6fefac7 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -36,7 +36,7 @@ Language-related extensions and extensions wanting to match the language of the `i18n.getOSLanguage()` would synchronously return a [BCP47 language tag](https://www.w3.org/International/core/langtags/rfc3066bis.html) like `i18n.getUILanguage()` does right now. -It would follow the following signature for [i18n.json](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/extensions/common/api/i18n.json): +It would follow the following signature for [i18n.json](https://chromium.googlesource.com/chromium/src/+/4299ce68496b32ba309e2f012e0db5b4b8cd478a/extensions/common/api/i18n.json): ```json From 6107700ca8a0fc798099ccad14d26c2d3cbcc5f1 Mon Sep 17 00:00:00 2001 From: carlosjeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:29:59 +0200 Subject: [PATCH 13/21] Update proposals/i18n-getOSLanguage.md Co-authored-by: Addison Phillips --- proposals/i18n-getOSLanguage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index d6fefac7..29583948 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -2,7 +2,7 @@ **Summary** -Allow to get the language of your operating system as an [BCP47 language tag](https://www.w3.org/International/core/langtags/rfc3066bis.html). +Allows getting the language/locale of your operating system as a [BCP47 language tag](https://www.rfc-editor.org/bcp/bcp47.html) **Document Metadata** From 38e9f399dfd635339247ae2c4c9ee02fcb212d37 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 23 May 2024 11:32:22 +0200 Subject: [PATCH 14/21] Update proposal to include both getPreferredSystemLanguages and getSystemUILanguage --- proposals/i18n-getOSLanguage.md | 39 ++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-getOSLanguage.md index 29583948..389a1cbe 100644 --- a/proposals/i18n-getOSLanguage.md +++ b/proposals/i18n-getOSLanguage.md @@ -2,7 +2,7 @@ **Summary** -Allows getting the language/locale of your operating system as a [BCP47 language tag](https://www.rfc-editor.org/bcp/bcp47.html) +Allows getting the language(s)/locale(s) of your operating system as a [BCP47 language tag](https://www.rfc-editor.org/bcp/bcp47.html) **Document Metadata** @@ -20,31 +20,50 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1888486 ### Objective -Allow extensions to display UI in the user's system language, even when this is distinct from the browser's UI language (which is restricted to languages supported by the browser). +Allow extensions to display UI in the user's system language(s), even when this is distinct from the browser's UI language (which is restricted to languages supported by the browser). #### Use Cases -Having the original OS language is useful for language-related extensions and for extensions who want to provide translations more true to the OS language. For example, to adapt to a specific sub-language, like Belgium-Dutch (nl-BE). While i18n.getUILanguage would return 'nl'. +Having the original system language(s) is useful for language-related extensions and for extensions who want to provide translations more true to the system language. For example, to adapt to a specific sub-language, like Belgium-Dutch (nl-BE). While i18n.getUILanguage would return 'nl'. ### Known Consumers -Language-related extensions and extensions wanting to match the language of the OS more closely independent of the langauge of the browser. +Language-related extensions and extensions wanting to match the language of the operating system more closely independent of the langauge of the browser. ## Specification ### Schema -`i18n.getOSLanguage()` would synchronously return a [BCP47 language tag](https://www.w3.org/International/core/langtags/rfc3066bis.html) like `i18n.getUILanguage()` does right now. +`i18n.getPreferredSystemLanguages()` would asynchronously return a list of [BCP47 language tag](https://www.rfc-editor.org/bcp/bcp47.html) like `i18n.getAcceptLanguages()` does right now. -It would follow the following signature for [i18n.json](https://chromium.googlesource.com/chromium/src/+/4299ce68496b32ba309e2f012e0db5b4b8cd478a/extensions/common/api/i18n.json): +```json +{ + "name": "getPreferredSystemLanguages", + "type": "function", + "description": "Gets the preferred languages of the operating system. This is different from the languages set in the browser; to get those, use $(ref:i18n.getAcceptLanguages).", + "parameters": [], + "returns_async": { + "name": "callback", + "parameters": [ + {"name": "languages", "type": "array", "items": {"$ref": "LanguageCode"}, "description": "Array of LanguageCode"} + ] + } +} + +``` +`i18n.getSystemUILanguage()` would synchronously return a [BCP47 language tag](https://www.rfc-editor.org/bcp/bcp47.html) like `i18n.getUILanguage()` does right now. + +The returned language tag can be different from the first entry returned by getPreferredSystemLanguages as the operating system could not support all languages specified by the user for its user interface. + +It would follow the following signature for [i18n.json](https://chromium.googlesource.com/chromium/src/+/4299ce68496b32ba309e2f012e0db5b4b8cd478a/extensions/common/api/i18n.json): ```json { - "name": "getOSLanguage", + "name": "getSystemUILanguage", "type": "function", "nocompile": true, - "description": "Gets the UI language of the Operating System. This is different from $(ref:i18n.getUILanguage) which returns the UI language of the web browser.", + "description": "Gets the current UI language of the Operating System. This is different from $(ref:i18n.getUILanguage) which returns the UI language of the web browser.", "parameters": [], "returns": { "type": "string", @@ -55,7 +74,7 @@ It would follow the following signature for [i18n.json](https://chromium.googles ### New Permissions -As `browser.i18n.getUILanguage()` does not require a permission, browser.i18n.getOSLanguage also should not. +As `browser.i18n.getUILanguage()` does not require a permission, browser.i18n.getSystemUILanguage and browser.i18n.getPreferredSystemLanguages also should not. ### Manifest File Changes @@ -65,7 +84,7 @@ No new manifest fields ### Exposed Sensitive Data -The language of the OS will be purposely exposed. +The language(s) of the system will be purposely exposed. ## Alternatives From 4eb3df17e7029a117c88a418abc59056198255a5 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 23 May 2024 11:32:51 +0200 Subject: [PATCH 15/21] Rename proposal file to better reflect the proposal --- proposals/{i18n-getOSLanguage.md => i18n-system-languages.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename proposals/{i18n-getOSLanguage.md => i18n-system-languages.md} (100%) diff --git a/proposals/i18n-getOSLanguage.md b/proposals/i18n-system-languages.md similarity index 100% rename from proposals/i18n-getOSLanguage.md rename to proposals/i18n-system-languages.md From 280efb56b34e928a1380d150abcaab85ca0c4bd5 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:56:26 +0200 Subject: [PATCH 16/21] Fix proposal title --- proposals/i18n-system-languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-system-languages.md b/proposals/i18n-system-languages.md index 389a1cbe..8c86f913 100644 --- a/proposals/i18n-system-languages.md +++ b/proposals/i18n-system-languages.md @@ -1,4 +1,4 @@ -# Proposal: i18n.getOSLanguage +# Proposal: i18n.getPreferredSystemLanguages() and i18n.getSystemUILanguage() **Summary** From 90dec9b665d03ebda8d1cc67ded82933ce049bb8 Mon Sep 17 00:00:00 2001 From: carlosjeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Fri, 14 Jun 2024 11:45:44 +0200 Subject: [PATCH 17/21] Update proposals/i18n-system-languages.md Co-authored-by: Pavel Djundik --- proposals/i18n-system-languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-system-languages.md b/proposals/i18n-system-languages.md index 8c86f913..4884ba66 100644 --- a/proposals/i18n-system-languages.md +++ b/proposals/i18n-system-languages.md @@ -28,7 +28,7 @@ Having the original system language(s) is useful for language-related extensions ### Known Consumers -Language-related extensions and extensions wanting to match the language of the operating system more closely independent of the langauge of the browser. +Language-related extensions and extensions wanting to match the language of the operating system more closely independent of the language of the browser. ## Specification From 1d995e9d618e6106e5e296b2f515bbbc9d9da875 Mon Sep 17 00:00:00 2001 From: carlosjeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Fri, 14 Jun 2024 16:47:57 +0200 Subject: [PATCH 18/21] Update proposals/i18n-system-languages.md Co-authored-by: Addison Phillips --- proposals/i18n-system-languages.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proposals/i18n-system-languages.md b/proposals/i18n-system-languages.md index 4884ba66..68d7b4b0 100644 --- a/proposals/i18n-system-languages.md +++ b/proposals/i18n-system-languages.md @@ -24,7 +24,9 @@ Allow extensions to display UI in the user's system language(s), even when this #### Use Cases -Having the original system language(s) is useful for language-related extensions and for extensions who want to provide translations more true to the system language. For example, to adapt to a specific sub-language, like Belgium-Dutch (nl-BE). While i18n.getUILanguage would return 'nl'. +Extension authors might want to obtain the locale used by the user agent's host environment in order to format values (such as numbers, dates, and so forth) or do other locale-affected operations (such as list sorting) according to expectations of the user. For example, formatting the date `2024-06-15` varies between `en-US` (6/15/2024) and `en-GB` (15/6/2024), whereas `i18n.getUILanguage` might return only `en` (English). + +Extension authors might want to obtain the locale used by the user agent's host environment to better match the runtime environment's localization. For example, the operating system might be running in `ff-NG` (Fulani as used in Nigeria), but the user agent might not be localized into this language and return `en` (English) for `i18n.getUILanguage`. ### Known Consumers From 89f08b38fd2d9f6a4002a3133209b9c2f5232af2 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:27:53 +0200 Subject: [PATCH 19/21] Clarify the type of list returned by getPreferredSystemLanguages --- proposals/i18n-system-languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/i18n-system-languages.md b/proposals/i18n-system-languages.md index 68d7b4b0..573209f5 100644 --- a/proposals/i18n-system-languages.md +++ b/proposals/i18n-system-languages.md @@ -36,7 +36,7 @@ Language-related extensions and extensions wanting to match the language of the ### Schema -`i18n.getPreferredSystemLanguages()` would asynchronously return a list of [BCP47 language tag](https://www.rfc-editor.org/bcp/bcp47.html) like `i18n.getAcceptLanguages()` does right now. +`i18n.getPreferredSystemLanguages()` would asynchronously return a language priority list (ordered list of [BCP47 language tag](https://www.rfc-editor.org/bcp/bcp47.html) like `i18n.getAcceptLanguages()` does right now. ```json { From 76acf81ed7ab8ad35973d2c3a49ddb7be0b9f8ef Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:31:14 +0200 Subject: [PATCH 20/21] Rewrite sentences to use locale instead of language when it makes sense --- proposals/i18n-system-languages.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/proposals/i18n-system-languages.md b/proposals/i18n-system-languages.md index 573209f5..55c54726 100644 --- a/proposals/i18n-system-languages.md +++ b/proposals/i18n-system-languages.md @@ -20,17 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1888486 ### Objective -Allow extensions to display UI in the user's system language(s), even when this is distinct from the browser's UI language (which is restricted to languages supported by the browser). +Allow extensions to display UI in the user's system locale(s), even when this is distinct from the browser's UI locale (which is restricted to locales supported by the browser). #### Use Cases Extension authors might want to obtain the locale used by the user agent's host environment in order to format values (such as numbers, dates, and so forth) or do other locale-affected operations (such as list sorting) according to expectations of the user. For example, formatting the date `2024-06-15` varies between `en-US` (6/15/2024) and `en-GB` (15/6/2024), whereas `i18n.getUILanguage` might return only `en` (English). -Extension authors might want to obtain the locale used by the user agent's host environment to better match the runtime environment's localization. For example, the operating system might be running in `ff-NG` (Fulani as used in Nigeria), but the user agent might not be localized into this language and return `en` (English) for `i18n.getUILanguage`. +Extension authors might want to obtain the locale used by the user agent's host environment to better match the runtime environment's localization. For example, the operating system might be running in `ff-NG` (Fulani as used in Nigeria), but the user agent might not be localized for this locale and return `en` (English) for `i18n.getUILanguage`. ### Known Consumers -Language-related extensions and extensions wanting to match the language of the operating system more closely independent of the language of the browser. +Language-related extensions and extensions wanting to match the locale of the operating system more closely independent of the locale of the browser. ## Specification @@ -86,13 +86,13 @@ No new manifest fields ### Exposed Sensitive Data -The language(s) of the system will be purposely exposed. +The locale(s) of the system will be purposely exposed. ## Alternatives ### Existing Workarounds -Currently, if an extension wants to offer languages outside of what the current browser language uses, it must do so by presenting a user-facing options page. However, currently there is no way to reasonably detect a language code outside of the browser's UI language with existing APIs. +Currently, if an extension wants to offer locales outside not localised for by the browser, it must do so by presenting a user-facing options page. However, currently there is no way to reasonably detect a language code outside of the browser's UI language with existing APIs. ### Open Web API From 395c02eba6ba57ce54129fdbc1c02b08ef42c6be Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:39:30 +0200 Subject: [PATCH 21/21] Add purest form use-case --- proposals/i18n-system-languages.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proposals/i18n-system-languages.md b/proposals/i18n-system-languages.md index 55c54726..8a68009d 100644 --- a/proposals/i18n-system-languages.md +++ b/proposals/i18n-system-languages.md @@ -28,6 +28,8 @@ Extension authors might want to obtain the locale used by the user agent's host Extension authors might want to obtain the locale used by the user agent's host environment to better match the runtime environment's localization. For example, the operating system might be running in `ff-NG` (Fulani as used in Nigeria), but the user agent might not be localized for this locale and return `en` (English) for `i18n.getUILanguage`. +Extension authors might want to obtain the locale used by the user agent's host environment in order to get the locales in it's purest form. For example, the operating system might be running in `es-AR` and a browser's closest equivalent is `es-419`. Having access to `es-AR` allows extension authors to provide better translations for all users. + ### Known Consumers Language-related extensions and extensions wanting to match the locale of the operating system more closely independent of the locale of the browser.