Closed Bug 1012702 Opened 10 years ago Closed 10 years ago

Make app names localizable into pseudolocales

Categories

(Firefox OS Graveyard :: Gaia::L10n, defect, P4)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stas, Assigned: stas)

References

Details

Attachments

(1 file)

Bug 900182 introduced the concept of pseudolocales.  Currently, pseudolocalizations don't affect app manifests (and thus, app names).

This will be needed for cases where tests want to check for a localized name of an app, like in bug 921939 which currently uses French.  It is thus blocking bug 1011519.
Priority: -- → P4
Depends on: 1041565
Green Try: https://tbpl.mozilla.org/?rev=85f6bc7fcbfb&tree=Gaia-Try
Summary: Make manifests localizable into pseudolocales → Make app names localizable into pseudolocales
Attached patch Patch 1Splinter Review
Pull request: https://github.com/mozilla-b2g/gaia/pull/22532

I counted five places in 

 1. verticalhome's grid,
 2. rocketbar,
 3. overlay when swiping from the edge,
 4. caption under task cards,
 5. Settings > App Permissions.

In the patch, I took care of Verticalhome in gaia_grid, and other places in manifest_helper.  The patch depends and requires the patch from bug 1041565, which should land very shortly.

Kevin, can you take a quick look at this?  Do you know if there are other places that I should check?
Assignee: nobody → stas
Status: NEW → ASSIGNED
Attachment #8469571 - Flags: feedback?(kgrandon)
Comment on attachment 8469571 [details] [diff] [review]
Patch 1

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

Sorry, but I don't think I can f+ this without trying some alternative solutions first. My understanding is that this for testing only, correct? If so, I prefer to find a solution that does not involve changing client code. I think there are some alternatives that we should explore, and only consider changing client code as a very last step. 

Have we considered an approach of building the pseudolocales into the app manifests at build time? Then everything would continue to work, and work with the new pseudolocales, no?
Attachment #8469571 - Flags: feedback?(kgrandon)
(In reply to Kevin Grandon :kgrandon from comment #4)

> Sorry, but I don't think I can f+ this without trying some alternative
> solutions first. My understanding is that this for testing only, correct?

No, this is so that app names are displayed pseudolocalized in Gaia, on runtime.

> Have we considered an approach of building the pseudolocales into the app
> manifests at build time? Then everything would continue to work, and work
> with the new pseudolocales, no?

Yes, but I think that dynamically generating pseudolanguages is a better approach:  it's consistent no matter what the actual build setup is.  Otherwise GAIA_INLINE_LOCALES, GAIA_CONCAT_LOCALES, GAIA_PRETRANSLATE and DEBUG would all require special treatment, increasing the complexity of the code.

I also want users to be able to toggle pseudolanguages on and off in production builds;  that's why we removed locales-obj/qps-*.json files (and never produced pseudo-properties on buildtime) which would only take valuable space on the device.

Building pseudolanguages into the manifest on buildtime also means that this owuld only work for Gaia apps.  Doing it on runtime allows even the third party apps to benefit from the pseudolocalization testing (if they use Gaia's l10n.js).

Extending the ManifestHelper to support pseudo languages seems like a good solution which is limited in scope.  Do you know if there are other apps except Verticalhome that don't use it?
What about extending the capability of data-l10n-id to pull out data from the manifest/app? E.g., data-l10n-id="manifest.locales.name", or something that pulls it out of the manifest.webapp file or even app object. You can then intercept these requests and do the action for core or third party apps.

It seems very strange to heavily discourage the use of .get(), then turn around and start implementing it for pseudo locales.
Oops, I see we are using .translate() instead of .get(), but it still seems like a hack?
(In reply to Kevin Grandon :kgrandon from comment #6)
> What about extending the capability of data-l10n-id to pull out data from
> the manifest/app? E.g., data-l10n-id="manifest.locales.name", or something
> that pulls it out of the manifest.webapp file or even app object. You can
> then intercept these requests and do the action for core or third party apps.

How would you use this data-l10n-id?  On which element?  Manifest data is not associated with any given DOM element.  I think overloading data-l10n-id would qualify as a hack.

> It seems very strange to heavily discourage the use of .get(), then turn
> around and start implementing it for pseudo locales.

> Oops, I see we are using .translate() instead of .get(), but it still seems
> like a hack?

It's called 'translate', but it could also be called apply, use, modify etc.  It's a method of Pseudo objects which transforms the given value into a pseudotranslation.  It doesn't have a state like get() does (the current language; list of resources; readiness of mozL10n), which is why I think it's safe to use here.
Hey Kevin, I'm back from vacation and would like to move forward with this bug. What do you think about comment 8?
Flags: needinfo?(kgrandon)
Comment on attachment 8469571 [details] [diff] [review]
Patch 1

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

I still think that having specialized runtime code for this is not a good idea, and I don't see value in running these on PRODUCTION profiles. I am willing however to f+ this and help you get it landed as it's pretty minor, and I think that any other solution would be a *lot* of code. These paper cuts and special cases add up over time though, and eventually the whole codebase suffers.
Attachment #8469571 - Flags: feedback+
Flags: needinfo?(kgrandon)
Thanks, Kevin.  I too try to avoid growing the codebase too much.  One added value of running pseudolocales in production builds is that we'll be able to make it easier for community members and even outsourced QA people to test locales they don't speak;  this is especially important for RTL languages.

I rebased my patch and I'm waiting for the Try results:

https://tbpl.mozilla.org/?rev=fbd062fe2592&tree=Gaia-Try

Do you know if there's someone else whom I should ask for review?  Is your f+ good for landing?
Comment on attachment 8469571 [details] [diff] [review]
Patch 1

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

You can land with my R+.
Attachment #8469571 - Flags: feedback+ → review+
Thanks, Kevin!

Commit: https://github.com/mozilla-b2g/gaia/commit/f998162201ff577573f81a2d053fde165108f699
Master: https://github.com/mozilla-b2g/gaia/commit/8f3fca981ad795670e6caaa2721ec98ae5f2a3a5
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Blocks: 1060384
No longer blocks: 1060384
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: