Closed Bug 1028370 Opened 10 years ago Closed 10 years ago

I cannot change Default target language . I want to translation default target language different from Firefox UI language.

Categories

(Firefox :: Translations, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: alice0775, Unassigned)

Details

Build Identifier:
https://hg.mozilla.org/mozilla-central/rev/bdac18bd6c74
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0 ID:20140620030201

I cannot change Default target language.

Steps To Reproduce:
1. Download Nightly en-US build

2. Enable translation.
   user_pref("browser.translation.detectLanguage", true);
   user_pref("browser.translation.ui.show", true);

   And optionally, set apikey for testing
   user_pref("browser.translation.bing.apiKeyOverride", xxxxx); 
   user_pref("browser.translation.bing.clientIdOverride", yyyyy);

2. Attempt to change Default target language.
   set intl.accept_languages, general.useragent.locale to ja (for example)
   --- Default target language is not changed...

Actual Results:
  I cannot change Default target language.

Expected Results:
  Default target language should be setting of intl.accept_languages or general.useragent.locale
I think general.useragent.locale controls the default target language, but given the implementation at http://mxr.mozilla.org/mozilla-central/source/browser/components/translation/Translation.jsm#38 changes won't take effect before a restart.
(In reply to Florian Quèze [:florian] [:flo] from comment #1)
> I think general.useragent.locale controls the default target language, but
> given the implementation at
> http://mxr.mozilla.org/mozilla-central/source/browser/components/translation/
> Translation.jsm#38 changes won't take effect before a restart.

Restarting browser does nothing to effect about the Default target language.
What is the typical purpose of changing general.useragent.locale? I thought it had no direct effect on the UI, and users should generally use a locale-switching add-on instead of messing with that pref directly.

As for intl.accept_languages, unfortunately we can't use that pref because every non-english locale includes en-US in the list, for website compatibility reasons. That's why we had to create our own pref, browser.translation.neverForLanguages, instead of using it.
(In reply to :Felipe Gomes from comment #3)
> What is the typical purpose of changing general.useragent.locale?

Nothing, I just want to change "Default target language".
Because, m-c hourly, fx-team and m-i provide only en-US build.
How I can test translation to other languages(non en-US) (i.e., English to Japanese) when I use m-c hourly, fx-team and m-i?
Summary: I cannot change Default target language. → I cannot change Default target language in m-c hourly, fx-team and m-i build (i.e., en-US build)
Flags: needinfo?(florian)
I'm not fully sure what you are trying to do here, but if you want to make the general.useragent.locale pref change the default target language for the translation, you would also need to have a language pack installed for that language.

If you are trying to use the feature on an English build to translate a pages that are already in English, that's not something we support.
Flags: needinfo?(florian)
(In reply to Florian Quèze [:florian] [:flo] from comment #6)
> I'm not fully sure what you are trying to do here, but if you want to make
> the general.useragent.locale pref change the default target language for the
> translation, you would also need to have a language pack installed for that
> language.

I do not want to change other language of Firefox UI.

> 
> If you are trying to use the feature on an English build to translate a
> pages that are already in English, that's not something we support.

Just want to translation target other than en-US in this case.
In other words, I want to translation target language different from Firefox UI language.
Summary: I cannot change Default target language in m-c hourly, fx-team and m-i build (i.e., en-US build) → I cannot change Default target language . I want to translation default target language different from Firefox UI language.
Oh ok, I think that having a translation-specific pref (instead of following the Firefox's UI) is not something we are planning to do soon, because it feels an uncommon edge case. I think this is good territory for a simple add-on for users who would want that (i.e., they use Firefox in English but would prefer default translation to be in another language).
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Oh if your goal is to be able to test m-c hourly, etc., (instead of this being a User use-case), you can use this snippet to change the default target language:

Cu.import("resource:///modules/translation/Translation.jsm",{}).Translation._defaultTargetLanguage = "pt"
(In reply to :Felipe Gomes from comment #9)
> Oh if your goal is to be able to test m-c hourly, etc., (instead of this
> being a User use-case), you can use this snippet to change the default
> target language:
> 
> Cu.import("resource:///modules/translation/Translation.jsm",{}).Translation.
> _defaultTargetLanguage = "pt"

It is a great.
Thank you for your good advice.
You need to log in before you can comment on or make changes to this bug.