Language switching for Gaia

RESOLVED FIXED in 1.0 beta

Status

L20n
JS Library
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: gandalf, Assigned: gandalf)

Tracking

unspecified
1.0 beta
x86
Mac OS X

Details

Attachments

(2 attachments, 2 obsolete attachments)

Comment hidden (empty)
(Assignee)

Comment 1

5 years ago
Once we have gaia bindings (bug 874110), we need a way to react to mozSettings change to language.current.
(Assignee)

Updated

5 years ago
Assignee: nobody → gandalf
Status: NEW → ASSIGNED
Target Milestone: --- → 1.0 beta
(Assignee)

Comment 2

5 years ago
Created attachment 751747 [details] [diff] [review]
extend Intl

First, we need a way to modify the locale selection from the bindings.

This patch adds a public property on Intl object that bindings can modify and prioritizeLocales uses.
Attachment #751747 - Flags: review?(stas)
(Assignee)

Comment 3

5 years ago
Created attachment 751748 [details] [diff] [review]
mozSettings patch

This patch adds mozSettings observer to gaia bindings.
Attachment #751748 - Flags: review?(stas)
(Assignee)

Updated

5 years ago
Depends on: 874110
Why two patches instead of one?
Comment on attachment 751747 [details] [diff] [review]
extend Intl

Review of attachment 751747 [details] [diff] [review]:
-----------------------------------------------------------------

::: lib/client/l20n/platform/intl.js
@@ +203,5 @@
>    }
>  
>    exports.Intl = {
> +    prioritizeLocales: prioritizeLocales,
> +    locales: [navigator.language]

Is prioritizeLocales non-standard and our own addition?  I don't see it in http://www.ecma-international.org/ecma-402/1.0/#sec-9

Can we make it take a second argument, requestedLocales, and move navigator.language out of intl.js completely and into the bindings?

That way we don't have to expose 'locales' on Intl at all.
Attachment #751747 - Flags: review?(stas) → review-
Attachment #751748 - Flags: review?(stas)
(Assignee)

Comment 6

5 years ago
(In reply to Staś Małolepszy :stas (needinfo along with cc, please) from comment #5)
> Comment on attachment 751747 [details] [diff] [review]
> extend Intl
> 
> Review of attachment 751747 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: lib/client/l20n/platform/intl.js
> @@ +203,5 @@
> >    }
> >  
> >    exports.Intl = {
> > +    prioritizeLocales: prioritizeLocales,
> > +    locales: [navigator.language]
> 
> Is prioritizeLocales non-standard and our own addition?  I don't see it in
> http://www.ecma-international.org/ecma-402/1.0/#sec-9

It's an internal function, but part of reference implementation. 

> Can we make it take a second argument, requestedLocales, and move
> navigator.language out of intl.js completely and into the bindings?

Yeah. good idea. I'll update the patch.
(Assignee)

Comment 8

5 years ago
Created attachment 752403 [details] [diff] [review]
extend Intl [landed]

patch that has actually landed
Attachment #751747 - Attachment is obsolete: true
(Assignee)

Comment 9

5 years ago
Created attachment 752404 [details] [diff] [review]
mozSettings patch

mozSettings patch
Attachment #751748 - Attachment is obsolete: true
Attachment #752404 - Flags: review?(stas)
Attachment #752404 - Flags: review?(stas) → review+
(Assignee)

Comment 10

5 years ago
https://github.com/l20n/l20n.js/commit/8bbd13ff2bda62a5880ee4942874d60cec7dde53
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.