Commit c7d84390 by Alexander Makarov

Fixes #3687: Default `sourceLanguage` and `language` are now `en-US` in order…

Fixes #3687: Default `sourceLanguage` and `language` are now `en-US` in order for i18n formatter to work correctly
parent 6bca1817
......@@ -325,8 +325,8 @@ without touching any dependent code.
#### [[yii\base\Application::sourceLanguage|sourceLanguage]] <a name="sourceLanguage"></a>
This property specifies the language that the application code is written in. The default value is `'en'`,
meaning English. You should configure this property if the text content in your code is not in English.
This property specifies the language that the application code is written in. The default value is `'en-US'`,
meaning English (United States). You should configure this property if the text content in your code is not in English.
Like the [language](#language) property, you should configure this property in terms of
an [IETF language tag](http://en.wikipedia.org/wiki/IETF_language_tag). For example, `en` stands for English,
......
......@@ -70,7 +70,7 @@ Yii tries to load appropriate translation from one of the message sources define
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
//'basePath' => '@app/messages',
//'sourceLanguage' => 'en',
//'sourceLanguage' => 'en-US',
'fileMap' => [
'app' => 'app.php',
'app/error' => 'error.php',
......@@ -323,7 +323,7 @@ class Module extends \yii\base\Module
{
Yii::$app->i18n->translations['modules/users/*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en',
'sourceLanguage' => 'en-US',
'basePath' => '@app/modules/users/messages',
'fileMap' => [
'modules/users/validation' => 'validation.php',
......@@ -370,7 +370,7 @@ class Menu extends Widget
$i18n = Yii::$app->i18n;
$i18n->translations['widgets/menu/*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en',
'sourceLanguage' => 'en-US',
'basePath' => '@app/widgets/menu/messages',
'fileMap' => [
'widgets/menu/messages' => 'messages.php',
......@@ -407,7 +407,7 @@ Sometimes you want to correct default framework message translation for your app
'translations' => [
'yii' => [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en',
'sourceLanguage' => 'en-US',
'basePath' => '/path/to/my/message/files'
],
],
......
......@@ -79,7 +79,7 @@ class DatePicker extends InputWidget
echo $this->renderWidget() . "\n";
$containerID = $this->inline ? $this->containerOptions['id'] : $this->options['id'];
$language = $this->language ? $this->language : Yii::$app->language;
if ($language != 'en') {
if ($language != 'en-US') {
$view = $this->getView();
DatePickerRegionalAsset::register($view);
......
......@@ -94,6 +94,7 @@ Yii Framework 2 Change Log
- Chg #3383: Added `$type` parameter to `IdentityInterface::findIdentityByAccessToken()` (qiangxue)
- Chg #3531: \yii\grid\GridView now allows any character (except ":") in the attribute part of the shorthand syntax for columns (rawtaz)
- Chg #3544: Added `$key` as a parameter to the callable specified via `yii\grid\DataColumn::value` (mdmunir)
- Chg #3687: Default `sourceLanguage` and `language` are now `en-US` in order for i18n formatter to work correctly (samdark)
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
- Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
- Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe)
......
......@@ -106,13 +106,13 @@ abstract class Application extends Module
* for English, while `en-US` stands for English (United States).
* @see sourceLanguage
*/
public $language = 'en';
public $language = 'en-US';
/**
* @var string the language that the application is written in. This mainly refers to
* the language that the messages and view files are written in.
* @see language
*/
public $sourceLanguage = 'en';
public $sourceLanguage = 'en-US';
/**
* @var Controller the currently active controller instance
*/
......
......@@ -57,7 +57,7 @@ class I18N extends Component
if (!isset($this->translations['yii']) && !isset($this->translations['yii*'])) {
$this->translations['yii'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en',
'sourceLanguage' => 'en-US',
'basePath' => '@yii/messages',
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment