Skip to content
This repository has been archived by the owner. It is now read-only.

Separate string needed for "Sign in" header #3128

Closed
splewako opened this issue Oct 3, 2015 · 14 comments
Closed

Separate string needed for "Sign in" header #3128

splewako opened this issue Oct 3, 2015 · 14 comments

Comments

@splewako
Copy link

@splewako splewako commented Oct 3, 2015

https://github.com/mozilla/fxa-content-server/blob/master/app/scripts/templates/sign_in.mustache#L4-L10

Polish and some other languages use different form for active elements like buttons and links than for headers or titles.

img_4088

@shane-tomlinson
Copy link
Member

@shane-tomlinson shane-tomlinson commented Oct 15, 2015

@splewako - We want to understand the request better because cross-language nuances are hard to comprehend when your native language doesn't have the concept.

Is "Sign in" in the header is different to "Sign in" when used as an imperative, like on the button?

@splewako
Copy link
Author

@splewako splewako commented Oct 15, 2015

Is "Sign in" in the header is different to "Sign in" when used as an imperative, like on the button?

Yes, as general rule imperative strings shouldn't be used as titles/headers, some locales use nouns for titles, and verbs for actions (for example button labels).

This may not be that visible on a webpage but for example in Firefox OS we often have different forms for settings item label (first) activating settings view with some title/header (second) and submit button (third) while en-US has only one form.

@shane-tomlinson
Copy link
Member

@shane-tomlinson shane-tomlinson commented Oct 16, 2015

Thanks @splewako - do you know of any resources where we could find out more about best practices?

@splewako
Copy link
Author

@splewako splewako commented Oct 16, 2015

https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_content_best_practices

Asking l10n-drivers team or on #l10n irc channel would be also good idea.

@rfk rfk added this to the FxA-0: quality milestone Oct 19, 2015
@vladikoff vladikoff self-assigned this Nov 2, 2015
@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Nov 4, 2015

@mathjazz did you ever have to deal with this type of issue?

@mathjazz
Copy link

@mathjazz mathjazz commented Nov 4, 2015

Yeah, title and button should be separate strings. You will have to use msgctxt to have two different entries with the same msgid in the PO file:
https://developer.mozilla.org/en-US/docs/gettext#Using_context_with_msgctxt

@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Nov 11, 2015

@zaach @shane-tomlinson we need to chat about getting the context value into our strings.

@zaach for .mustache templates does this make sense:

before:

{{#t}}Create a Firefox Account{{/t}}

after:

{{#t context="header"}}Create a Firefox Account{{/t}}

This should extract as:

#: app/scripts/templates/sign_up.mustache:1
#: app/scripts/templates/sign_up.mustache:4
msgctxt "header"
msgid "Create a Firefox Account"
msgstr ""

I'm not sure what to do with t(..) helpers. From docs: https://github.com/zaach/jsxgettext#jsxgettext-- it seems plural forms will get into the way of the context values.

Ideas?

Ref: https://github.com/zaach/jsxgettext

@vladikoff vladikoff removed their assignment Nov 11, 2015
@vladikoff vladikoff added this to the FxA-62: l10n tooling milestone Nov 11, 2015
@vladikoff vladikoff removed this from the FxA-0: quality milestone Nov 11, 2015
@zaach
Copy link
Contributor

@zaach zaach commented Nov 17, 2015

It looks like there's an open jsxgettext issue for contexts:
zaach/jsxgettext#94

Ref:
http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/xgettext-Invocation.html
(scroll to --keyword=keywordspec)

On Wed, Nov 11, 2015 at 11:29 AM, Vlad Filippov notifications@github.com
wrote:

@zaach https://github.com/zaach @shane-tomlinson
https://github.com/shane-tomlinson we need to chat about getting the
context value into our strings.

@zaach https://github.com/zaach for .mustache templates does this make
sense:

before:

{{#t}}Create a Firefox Account{{/t}}

after:

{{#t context=''header"}}Create a Firefox Account{{/t}}

This should extract as:

#: app/scripts/templates/sign_up.mustache:1
#: app/scripts/templates/sign_up.mustache:4
msgctxt "header"
msgid "Create a Firefox Account"
msgstr ""

I'm not sure what to do with t(..) helpers. From docs:
https://github.com/zaach/jsxgettext#jsxgettext-- it seems plural forms
will get into the way of the context values.

Ideas?

Ref: https://github.com/zaach/jsxgettext


Reply to this email directly or view it on GitHub
#3128 (comment)
.

Zach Carter

@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Nov 20, 2015

We need to patch everything for this.

https://github.com/zaach/jsxgettext-recursive should be looking for handlebars attributes. pass them on to the templates and we also need to adjust our translation function to make sure it picks up the right string based on its context (from json??)

@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Nov 20, 2015

from talking to @zaach:

for

{{#tc context="header"}}Create a Firefox Account{{/tc}} we should be able to get the attrs with the handlebars parser.

For js strings , we need to add another helper for strings that have context and it might look like something like this:

tc('hi', 'header') -> for strings with context
t('hi') -> for strings with no context

@vladikoff vladikoff removed their assignment Nov 23, 2015
@shane-tomlinson
Copy link
Member

@shane-tomlinson shane-tomlinson commented Dec 7, 2015

tc('hi', 'header') -> for strings with context
t('hi') -> for strings with no context

context is pretty overloaded when it comes to l10n. context here is used to mean "where is this string used?" context in views.js means "the data used for string interpolation". For our own sanity, let's decide on standardized nomenclature and use distinct names for these two concepts. If we have to update the name of the thing we currently call context, so be it.

Second, are we 100% positive context is only ever going to be a string? Could it ever be a number/object/something-more-complex?

@zaach
Copy link
Contributor

@zaach zaach commented Dec 8, 2015

Second, are we 100% positive context is only ever going to be a string? Could it ever be a number/object/something-more-complex?

xgettext-like tools will expect a string literal.

@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Jan 7, 2016

Another contributor sent a related message to this:

Hi Vlad, 

Could you clarify what is the context of the string "(current)"? I 
assume there would be an implied noun or similar to go along with it? 

Also, I don't know if there are technical limits or if this has been 
discussed before, but it'd be very helpful if partial strings like this 
one had comments in .po file that translators could see in their tools. 

Merike 
@rfk rfk removed their assignment Apr 18, 2016
shane-tomlinson pushed a commit that referenced this issue Apr 7, 2017
Use a triple / (///) to give a `t` a context that will
be used as a comment for the l10n team.

issue #3128
shane-tomlinson pushed a commit that referenced this issue Apr 7, 2017
Use a triple / (///) to give a `t` a context that will
be used as a comment for the l10n team.

issue #3128
@vladikoff vladikoff closed this in c818489 Apr 11, 2017
@shane-tomlinson
Copy link
Member

@shane-tomlinson shane-tomlinson commented Apr 11, 2017

\*/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants