mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Used intl ICU for message translation
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
Internationalization
|
||||
====================
|
||||
|
||||
Internationalization (I18N) refers to the process of designing a software application so that it can be adapted to
|
||||
various languages and regions without engineering changes. For Web applications, this is of particular importance
|
||||
because the potential users may be worldwide.
|
||||
|
||||
When developing an application it's assumed that we're relying on
|
||||
[PHP internationalization extension](http://www.php.net/manual/en/intro.intl.php). While extension covers a lot of aspects
|
||||
Yii adds a bit more:
|
||||
|
||||
- It handles message translation.
|
||||
|
||||
|
||||
Locale and Language
|
||||
-------------------
|
||||
|
||||
Translation
|
||||
-----------
|
||||
|
||||
/*
|
||||
|
||||
numeric arg \{\s*\d+\s*\}
|
||||
named arg \{\s*(\w|(\w|\d){2,})\s*\}
|
||||
|
||||
named placeholder can be unicode!!!
|
||||
|
||||
|
||||
argName [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+
|
||||
|
||||
message = messageText (argument messageText)*
|
||||
argument = noneArg | simpleArg | complexArg
|
||||
complexArg = choiceArg | pluralArg | selectArg | selectordinalArg
|
||||
noneArg = '{' argNameOrNumber '}'
|
||||
simpleArg = '{' argNameOrNumber ',' argType [',' argStyle] '}'
|
||||
choiceArg = '{' argNameOrNumber ',' "choice" ',' choiceStyle '}'
|
||||
pluralArg = '{' argNameOrNumber ',' "plural" ',' pluralStyle '}'
|
||||
selectArg = '{' argNameOrNumber ',' "select" ',' selectStyle '}'
|
||||
selectordinalArg = '{' argNameOrNumber ',' "selectordinal" ',' pluralStyle '}'
|
||||
choiceStyle: see ChoiceFormat
|
||||
pluralStyle: see PluralFormat
|
||||
selectStyle: see SelectFormat
|
||||
argNameOrNumber = argName | argNumber
|
||||
argName = [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+
|
||||
argNumber = '0' | ('1'..'9' ('0'..'9')*)
|
||||
argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duration"
|
||||
argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText
|
||||
*/
|
Reference in New Issue
Block a user