If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Add contexts to Editor Brand L10n

RESOLVED FIXED

Status

Marketplace
General
P1
normal
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: clouserw, Assigned: chuck)

Tracking

Points:
---
Dependency tree / graph

Details

(Whiteboard: [qa-])

(Reporter)

Description

3 years ago
In general, you want to translate as few strings as possible so gettext defaults to collapsing strings that are used more than once.  For example, "OK" or "Yes" probably gets used a lot but it only shows up in the .po file once.  Normally this is what you want, however, Scott is doing some non-standard localizations where, for example, Music is localized as For Music Lovers in some languages and not others.  This means the strings can't be shared with any others in the .po file.

Several Editor Brands share their default names with existing categories which is causing collisions here.  For example:  https://github.com/mozilla/fireplace/blob/master/locale/bn_BD/LC_MESSAGES/messages.po#L674 .  Note that it shows it being used in /media/js/categories.js and /media/js/feed.js.  It tried to do you a favor. :(

Gettext addresses this situation by supporting contexts (https://www.gnu.org/software/gettext/manual/html_node/Contexts.html).  This is generally done by accepting another string parameter at the end of gettext() and ngettext().  For example, 'addon_display_header_version' is the context at https://github.com/mozilla/olympia/blob/master/apps/versions/templates/versions/mobile/version.html#L6 and https://github.com/mozilla/olympia/blob/master/locale/en_US/LC_MESSAGES/messages.po#L8402 is what it looks like in the .po file.

You can see an implementation at https://developer.mozilla.org/en-US/docs/gettext#Using_context_with_msgctxt both for extracting into the .po files and using the .po files in the code.* 

Let me know if there are questions.

* This page is actually really sweet, because googling for things like --keyword=n___:1,2,4c the first time was really rough.
(Assignee)

Updated

3 years ago
Depends on: 1055849
(Reporter)

Comment 1

3 years ago
An alternative to this would be to put these strings in their own .po file.
(Assignee)

Updated

3 years ago
Assignee: nobody → charmston
(Assignee)

Comment 2

3 years ago
feed branch: https://github.com/mozilla/fireplace/compare/bf87edc8ef12...6e92ed2ef81c
master: https://github.com/mozilla/fireplace/compare/d34ea1e3ae21...a204dfecd637
curation tools: https://github.com/mozilla/transonic/compare/228dd5c44f48...82bc1b90c13c
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.