Closed Bug 1055851 Opened 10 years ago Closed 10 years ago

Add contexts to Editor Brand L10n

Categories

(Marketplace Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: clouserw, Assigned: chuck)

References

Details

(Whiteboard: [qa-])

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.
Depends on: 1055849
An alternative to this would be to put these strings in their own .po file.
Assignee: nobody → charmston
You need to log in before you can comment on or make changes to this bug.