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.
Polsih English Literals

API changes

No

#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.

Files: 
CommentFileSizeAuthor
#4 2067435-4-test-do-not-test.patch1.37 KBstkrzysiak
#1 2067435-1.patch3.76 KBstkrzysiak
PASSED: [[SimpleTest]]: [MySQL] 58,286 pass(es). View
#1 2067435-1-test.patch1.47 KBstkrzysiak
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2067435-1-test.patch. Unable to apply patch. See the log in the details link for more information. View
Screen Shot 2013-08-16 at 2.16.20 PM.png16.82 KBstkrzysiak

Comments

stkrzysiak’s picture

FileSize
1.47 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2067435-1-test.patch. Unable to apply patch. See the log in the details link for more information. View
3.76 KB
PASSED: [[SimpleTest]]: [MySQL] 58,286 pass(es). View

I'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.

YesCT’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2067435-1-test.patch, failed testing.

stkrzysiak’s picture

Just 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

SimpleXMLElement::__set_state(array(
   '@attributes' => 
  array (
    'value' => 'en',
    'selected' => 'selected',
  ),
   0 => 'English',
))
stkrzysiak’s picture

Just an update. Haven't forgotten about this, busy end of quarter, trying to get to it this week.

Gábor Hojtsy’s picture

You 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.

stkrzysiak’s picture

Gá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?

Gábor Hojtsy’s picture

The 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.

Gábor Hojtsy’s picture

More docs on context at https://drupal.org/node/1928898

stkrzysiak’s picture

Thank 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.

stkrzysiak’s picture

Issue summary: View changes

Updated issue summary.

vasi1186’s picture

Assigned: Unassigned » vasi1186
Issue summary: View changes
vasi1186’s picture

Should 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()?

Gábor Hojtsy’s picture

Status: Needs work » Postponed
Issue tags: +sprint

#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.

Gábor Hojtsy’s picture

Issue tags: -sprint

Removing from sprint since this was postponed for so long....

mgifford’s picture

fran seva’s picture

Status: Postponed » Closed (duplicate)