Updated: Comment #0
Problem/Motivation
Now that we will have English as a configuration language selector, let's get the translated version of it there.
For example, if I am running a Polish site, I shouldn't see 'English', I should see 'Angielski'
Proposed resolution
Wrap the option is t()
//line 260
$element['#options'] = array($langcode => t($list[$langcode][0])) + $element['#options'];
//linen 249
$element['#options'][$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : t($language->name);
Remaining tasks
- incomplete: fix and patch
- incomplete: code review
- incomplete: update unit test
- incomplete: manual test
User interface changes
English becomes 'Angielski' in Polish, or whatever the site default translation is.
API changes
No
Related Issues
#1936216: Configuration language selectors should have English even if English is not on the site
Steps to Reproduce
Install Drupal in another language.
Apply patch from #1936216: Configuration language selectors should have English even if English is not on the site
Go to admin/structure/menu/manage/main, note the English versions of 'English' and whatever language you installed in.
Comment | File | Size | Author |
---|---|---|---|
#4 | 2067435-4-test-do-not-test.patch | 1.37 KB | stkrzysiak |
#1 | 2067435-1.patch | 3.76 KB | stkrzysiak |
#1 | 2067435-1-test.patch | 1.47 KB | stkrzysiak |
Screen Shot 2013-08-16 at 2.16.20 PM.png | 16.82 KB | stkrzysiak |
Comments
Comment #1
stkrzysiak CreditAttribution: stkrzysiak commentedI'm updating my progress with this, as I have to leave #mwds :/ I am still working on the test, and I feel my patch for this fixes the issue. I will continue on this tomorrow. Still learning how to write tests. Attached a test only patch and the 'fix only' patch.
Comment #2
YesCT CreditAttribution: YesCT commentedComment #4
stkrzysiak CreditAttribution: stkrzysiak commentedJust updating my test, made some progress but not done yet. Will get back to it and hopefully update Friday. A bit stuck on accessing the 0 => 'English' element in the following SimpleXMLElement
Comment #5
stkrzysiak CreditAttribution: stkrzysiak commentedJust an update. Haven't forgotten about this, busy end of quarter, trying to get to it this week.
Comment #6
Gábor HojtsyYou know this is a very valid bug report. However I'd say t() should not be used on languages since languages are now config entities, and they have translations with config entities. This may sound like a bit overkill, but t() is really only useful for shipped languages. People may as well set up their own languages (eg. local variants, informal stuff, etc). Those can only be translated via the config translation system.
Comment #7
stkrzysiak CreditAttribution: stkrzysiak commentedGábor,
I believe I follow you, but if not t() then what? Not sure how else to show translations? Should we just go with t() for now until there is a better solution?
Comment #8
Gábor HojtsyThe code should use the config context system, config_context_enter(), config_context_leave(). Pretty much the same problem in #2107427: Regression: Language names should display in their native names in the language switcher block.
Comment #9
Gábor HojtsyMore docs on context at https://drupal.org/node/1928898
Comment #10
stkrzysiak CreditAttribution: stkrzysiak commentedThank you Gábor,
I will try to get to this this week(I will assign accordingly). If anyone else can pick it up, please do, I just assumed quite a bit or responsibility at my 9-5 and I'm concerned I may not have time.
Comment #10.0
stkrzysiak CreditAttribution: stkrzysiak commentedUpdated issue summary.
Comment #11
vasi1186 CreditAttribution: vasi1186 commentedComment #12
vasi1186 CreditAttribution: vasi1186 commentedShould we wait for #2107427: Regression: Language names should display in their native names in the language switcher block that would make possible to use the call to language_list() to get the localized languages, and not have to use config_context_enter() and config_context_leave()?
Comment #13
Gábor Hojtsy#2107427: Regression: Language names should display in their native names in the language switcher block will display each langauge with its own native name. #1879930: Language selectors are not showing localized to the page language is more similar and deals with language selector in the interface (maybe a duplicate of this one, or vice versa). I'd say postpone on the base issue, since however that introduces the translation will need to be extended / used here.
Comment #14
Gábor HojtsyRemoving from sprint since this was postponed for so long....
Comment #15
mgiffordDo we have to wait for #1879930: Language selectors are not showing localized to the page language?
Comment #16
fran seva CreditAttribution: fran seva commentedThis issue is duplicated #1879930: Language selectors are not showing localized to the page language.