add i18n
This commit is contained in:
parent
5163f1a9a9
commit
fd181e580f
@ -12,7 +12,6 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?php echo Yii::t('common', 'Create')?>
|
||||
|
||||
<?= $form->field($model, 'username')->textInput() ?>
|
||||
<?= $form->field($model, 'email')->textInput() ?>
|
||||
|
||||
81
common/config/i18n.php
Normal file
81
common/config/i18n.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
yii message/config @common/config/i18n.php // generate i18n.php
|
||||
yii message/extract @common/config/i18n.php //generate message files
|
||||
*
|
||||
* */
|
||||
return [
|
||||
// string, required, root directory of all source files
|
||||
'sourcePath' => __DIR__. '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR,
|
||||
// array, required, list of language codes that the extracted messages
|
||||
// should be translated to. For example, ['zh-CN', 'de'].
|
||||
'languages' => ['hu'],
|
||||
// string, the name of the function for translating messages.
|
||||
// Defaults to 'Yii::t'. This is used as a mark to find the messages to be
|
||||
// translated. You may use a string for single function name or an array for
|
||||
// multiple function names.
|
||||
'translator' => 'Yii::t',
|
||||
// boolean, whether to sort messages by keys when merging new messages
|
||||
// with the existing ones. Defaults to false, which means the new (untranslated)
|
||||
// messages will be separated from the old (translated) ones.
|
||||
'sort' => false,
|
||||
// boolean, whether to remove messages that no longer appear in the source code.
|
||||
// Defaults to false, which means each of these messages will be enclosed with a pair of '@@' marks.
|
||||
'removeUnused' => false,
|
||||
// array, list of patterns that specify which files (not directories) should be processed.
|
||||
// If empty or not set, all files will be processed.
|
||||
// Please refer to "except" for details about the patterns.
|
||||
'only' => ['*.php'],
|
||||
// array, list of patterns that specify which files/directories should NOT be processed.
|
||||
// If empty or not set, all files/directories will be processed.
|
||||
// A path matches a pattern if it contains the pattern string at its end. For example,
|
||||
// '/a/b' will match all files and directories ending with '/a/b';
|
||||
// the '*.svn' will match all files and directories whose name ends with '.svn'.
|
||||
// and the '.svn' will match all files and directories named exactly '.svn'.
|
||||
// Note, the '/' characters in a pattern matches both '/' and '\'.
|
||||
// See helpers/FileHelper::findFiles() description for more details on pattern matching rules.
|
||||
// If a file/directory matches both a pattern in "only" and "except", it will NOT be processed.
|
||||
'except' => [
|
||||
'.svn',
|
||||
'.git',
|
||||
'.gitignore',
|
||||
'.gitkeep',
|
||||
'.hgignore',
|
||||
'.hgkeep',
|
||||
'/messages',
|
||||
],
|
||||
|
||||
// 'php' output format is for saving messages to php files.
|
||||
'format' => 'php',
|
||||
// Root directory containing message translations.
|
||||
'messagePath' => __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR . 'messages',
|
||||
// boolean, whether the message file should be overwritten with the merged messages
|
||||
'overwrite' => true,
|
||||
|
||||
// Message categories to ignore
|
||||
'ignoreCategories' => [
|
||||
'yii',
|
||||
],
|
||||
|
||||
/*
|
||||
// 'db' output format is for saving messages to database.
|
||||
'format' => 'db',
|
||||
// Connection component to use. Optional.
|
||||
'db' => 'db',
|
||||
// Custom source message table. Optional.
|
||||
// 'sourceMessageTable' => '{{%source_message}}',
|
||||
// Custom name for translation message table. Optional.
|
||||
// 'messageTable' => '{{%message}}',
|
||||
*/
|
||||
|
||||
/*
|
||||
// 'po' output format is for saving messages to gettext po files.
|
||||
'format' => 'po',
|
||||
// Root directory containing message translations.
|
||||
'messagePath' => __DIR__ . DIRECTORY_SEPARATOR . 'messages',
|
||||
// Name of the file that will be used for translations.
|
||||
'catalog' => 'messages',
|
||||
// boolean, whether the message file should be overwritten with the merged messages
|
||||
'overwrite' => true,
|
||||
*/
|
||||
];
|
||||
@ -7,5 +7,13 @@ return [
|
||||
'cache' => [
|
||||
'class' => 'yii\caching\FileCache',
|
||||
],
|
||||
'i18n' => [
|
||||
'translations' => [
|
||||
'*' => [
|
||||
'class' => 'yii\i18n\PhpMessageSource',
|
||||
'basePath' => '@common/messages',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
34
common/messages/hu/app.php
Normal file
34
common/messages/hu/app.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Aktív' => '',
|
||||
'Are you sure you want to delete this item?' => '',
|
||||
'Delete' => '',
|
||||
'Felhasználók' => '',
|
||||
'Inaktív' => '',
|
||||
'Jelszó' => '',
|
||||
'Jelszó és jelszó újra nem egyezik!' => '',
|
||||
'Jelszó újra' => '',
|
||||
'Keresés' => '',
|
||||
'Mentés' => '',
|
||||
'Update' => '',
|
||||
'Update {modelClass}: ' => '',
|
||||
'Users' => '',
|
||||
'Új felhasználó' => '',
|
||||
];
|
||||
21
common/messages/hu/common.php
Normal file
21
common/messages/hu/common.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Create' => 'Mentés',
|
||||
];
|
||||
Loading…
Reference in New Issue
Block a user