Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
28dbd5ac
Commit
28dbd5ac
authored
Jan 11, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added doc about translating message.
parent
a12b3d24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
translations.md
docs/internals/translations.md
+5
-2
config.php
framework/messages/config.php
+1
-1
No files found.
docs/internals/translations.md
View file @
28dbd5ac
...
...
@@ -7,12 +7,15 @@ where contribution is very welcome are documentation and framework messages.
Framework messages
------------------
Framework has two types of mess
s
ages: exceptions that are intended to developer and are never translated and messages
Framework has two types of messages: exceptions that are intended to developer and are never translated and messages
that are actually visible to end user such as validation errors.
In order to start with message translation:
1.
Check
`framework/messages/config.php`
and make sure your language is listed in
`languages`
.
1.
Check
`framework/messages/config.php`
and make sure your language is listed in
`languages`
. If not,
add your language there (remember to keep the list in alphabetical order). The format of language code
should follow
[
IETF language tag spec
](
http://en.wikipedia.org/wiki/IETF_language_tag
)
, for example,
`ru`
,
`zh-CN`
.
2.
Go to
`framework`
and run
`yii message/extract messages/config.php`
.
3.
Translate messages in
`framework/messages/your_language/yii.php`
. Make sure file is saved using UTF-8 encoding.
4.
[
Make a pull request
](
https://github.com/yiisoft/yii2/blob/master/docs/internals/git-workflow.md
)
.
...
...
framework/messages/config.php
View file @
28dbd5ac
...
...
@@ -7,7 +7,7 @@ return [
'messagePath'
=>
__DIR__
,
// array, required, list of language codes that the extracted messages
// should be translated to. For example, ['zh-CN', 'de'].
'languages'
=>
[
'ar'
,
'da'
,
'de'
,
'es'
,
'it'
,
'ja'
,
'pl'
,
'pt-BR'
,
'ro'
,
'ru'
,
'sr'
,
'sr-Latn'
,
'zh-CN'
],
'languages'
=>
[
'ar'
,
'da'
,
'de'
,
'es'
,
'it'
,
'ja'
,
'pl'
,
'pt-BR'
,
'ro'
,
'ru'
,
'sr'
,
'sr-Latn'
,
'zh-CN'
],
// 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment