Remove "localeid" localization constatant

This commit is contained in:
Dmitriy Simushev 2014-06-17 13:30:15 +00:00
parent 7c183fbe73
commit ec2574d707
2 changed files with 22 additions and 7 deletions

View File

@ -50,8 +50,8 @@ class TranslationController extends AbstractController
$page = array( $page = array(
'lang1' => $source, 'lang1' => $source,
'lang2' => $target, 'lang2' => $target,
'title1' => isset($lang1['localeid']) ? $lang1['localeid'] : $source, 'title1' => $this->getLocaleName($source),
'title2' => isset($lang2['localeid']) ? $lang2['localeid'] : $target, 'title2' => $this->getLocaleName($target),
'errors' => array(), 'errors' => array(),
); );
@ -59,7 +59,7 @@ class TranslationController extends AbstractController
$locales_list = array(); $locales_list = array();
$all_locales = get_available_locales(); $all_locales = get_available_locales();
foreach ($all_locales as $loc) { foreach ($all_locales as $loc) {
$locales_list[] = array('id' => $loc, 'name' => getlocal('localeid', null, $loc)); $locales_list[] = array('id' => $loc, 'name' => $this->getLocaleName($loc));
} }
// Prepare localization constants to display. // Prepare localization constants to display.
@ -148,8 +148,8 @@ class TranslationController extends AbstractController
$lang2 = load_messages($target); $lang2 = load_messages($target);
$page = array( $page = array(
'title1' => isset($lang1['localeid']) ? $lang1['localeid'] : $source, 'title1' => $this->getLocaleName($source),
'title2' => isset($lang2['localeid']) ? $lang2['localeid'] : $target, 'title2' => $this->getLocaleName($target),
// Use errors list stored in the request. We need to do so to have // Use errors list stored in the request. We need to do so to have
// an ability to pass the request from the "submitEditForm" action. // an ability to pass the request from the "submitEditForm" action.
'errors' => $request->attributes->get('errors', array()), 'errors' => $request->attributes->get('errors', array()),
@ -220,4 +220,21 @@ class TranslationController extends AbstractController
return $this->render('translation_edit', $page); return $this->render('translation_edit', $page);
} }
/**
* Builds human readable locale name in "<Native name> (<code>)" format.
*
* @param string $locale Locale code according to RFC 5646.
* @return string Human readable locale name.
*/
protected function getLocaleName($locale)
{
$names = get_locale_names();
if (isset($names[$locale])) {
return sprintf('%s (%s)', $names[$locale], $locale);
}
return $locale;
}
} }

View File

@ -460,8 +460,6 @@ msgid "license.title"
msgstr "License" msgstr "License"
msgid "localedirection" msgid "localedirection"
msgstr "ltr" msgstr "ltr"
msgid "localeid"
msgstr "English (en)"
msgid "mail_template.actions" msgid "mail_template.actions"
msgstr "Modify" msgstr "Modify"
msgid "mail_template.actions.edit" msgid "mail_template.actions.edit"