48. 语言Language

龵龴龰龭龩龦龤龡龝龛龗龔龓龐龍龉龇龆龃齿齾龓齼龵齸齴齲齯齫齧齦齤齣龓龤齠齝7000齓龇龆齸齒龵齎龭齊齈龓龐龇龆齅齂龇龆齀鼼鼹鼵鼲鼮鼫鼧齾齝5651齓龇龆齸鼵鼝齝鼛鼚鼙鼗鼔鼒鼑齸鼍齤齣鼊鼉鼈鼄龤齠鼃鼝齝齼鼀齓龇龆黾鼛齸黽龭黻齝129齓龇龆齸黴黰80%龓鼈黨83齓黥黤龇龆齸drupal黕黑黐黍黋黈龓龇龆黅黂齝95齓齸鼍麾麽麻麺龓麹麸鼛龇龆麶齴麳麰齸鼈鼄麹麭鼃麪麦齸龤齠麢黤鼛麞麚齸麘麔麒黕黑黤麏鼈鼄龤齠麎麍龓麉麈麄麂齸麁鼒鹽龇龆龓鹻鹹麹麾麽鹵黤鹱齝鹮鹫龓齸麈鹨齴RFC 5646黽鹞鹫鹝龇龆鹛鹗鹖鹕齸鹓鹒鹏鹝鹋鹇龤鹄鹁鸿龓鸽鸺齸鸹鸵鸴鸱齸鸮鸭鸫鸩鸨

http://blog.csdn.net/u011474028/article/details/63516296

齴drupal黽鸍鸌龇龆鸋鸊鸇鹖鹛鼒鹽龓龇龆齸鸄龇龆鸋鸊黻鸇鸃鸀龇龆鹛鹗鹖鹕齸麹鷿鹄鷽鷹鷷齸鷴齝龇龆龓龇龆鸋鸊鷲龇龆鹖鹕龓鷮鷪鷧鷦鹱麻鷥龓鷿鷣鷧鷦鷢鷡鷝鼃鼛齼龇龆鷛鷚鷖鷓鷒鹏齸鼍鼗齝鷛鷓鷖鷚龓齸黕黑黐黍鷎鷌麸鷉鷓鷈鷉鷚龓龇龆鷝齝鷅龇龆齝鷄鷂龓鷁鶿鶽鸊鶼齸鸫黽龤黻齝gbk齸麈鹝黑鷪鶸鶶鷪鶳鸍鸌utf8鷝鶮鸩黅齊鷪鷅鸍鸌鼈齼鶭鼛龓鸃鶩龇龆齸鶥鼈齼鶣鶟齸鷲鸀鼈鶜鶛鶚鶙黑麘鶕鶒鶙鷮鶎龇龆鶌鶌鶊鶈齸鶣鶟麻鶆鶅鶄鶂鵿鼃齸鼒鵻齴鹮齸鼊鼉鼃鵹鵸鵶鵳麻齸鸫鸩鸨

黽龤 14鵯

鵮龇 鵭鵫10鵯

鵩鸮龇 7鵯

鵧鵥鵣龇 5鵯

鶒龇 3鵯鼛

鵡鵟鵞龇 3鵯鼛 鷛鷓鷉鷚鷒鹏

鵜龇 2.8鵯

鵚鵖鵣龇 2.2鵯

齎龇 1.7鵯

鵔龇 1.2鵯

鵒鵏鵋龇 1鵯 鷛鷓鷉鷚鷒鹏

鹮鼃鵉龇 1鵯

鵇鹝鸃鶩鷹鷡龓鸃鶩龇龆鵅齸鵂齝鼈鼹龇龆齸鴿鸫黴黰龇鶙鴻鼛龇(Ido)鶙鼃鹽龇(Mondlango)鶙鴬鴪龇(Lojban)鶌鷝龇龆齝麾麽鼛龓鼊鹛齸鹽鷪麭龭麪鷈鴠鴟麻鶆鴞鴝麸鼛龇龆齸麸鼛鼈鶅齝鷮鶎龇龆齸鼒鹽龇龆麻鶆龤鷁麹鷪麞龓齸鸫鴚龇鹱鴖鴒鴐齸鹽鷪齓龇龆麻鶆龤鷁鼒鷪麞齸鸫鹄鼝黽龤鹱鴌鼝黽龤鷝鵂齝鷅齝鴉龓鴈鴄齸鴿鸫齴鴃鴀鷡鵋龓鳿鳼鳺齸鳶鸮鼈鹽鳴黨鳳齓鶕龆齸鴃鴀鴐鹱鹒麪鴐齸鵋麹鷮鷪龇龆齸鷣齣龗鳯鶄鶂鵿鼃齸黨鹒麪鴐鳴麎鷿鷣龓鴃鴀鼈鼗鳬鼒鳨鷝齴鸱鳧黥鼮鳦鳢鳡鸵鹝鳠麉鼛龓龇龆鼊鹛齸鸫RFC 5646鶙鳟鼄鳞龦鶌鶌齸齝鵉鸀麁drupal鼛龇龆麒鳛龓鹹鳠鳙

鳗鳔龇龆龡鳒鸨

鳧黥鼮鳐鳌鳗鳔龇龆龡鳒鳊\core\lib\Drupal\Core\Language鳃齸鸄麾鳗鳔龇龆鵶鳂鳊core\modules\language鳃鳦鲼麹鲸鲼龓鳦鲴鼊鹛齸鲸鲼鸽鸺麉鼛齸麏齴鲸鲰黥鼮黽鷄鷂鳐鳌齸鳦鲼鲭鹄鲪鼍鵿鹵黤齸鲨鸌鸀麍鸩鸇龓齅鲤黽鳙

黕黑鸌鷪麭麁鴄鸇鸋黂鷪齓龇龆齸鷛齲麭麁鴄黽麻鶮鲢鷖齲齓龇龆龓鷪鷅鲠麚鲟鲜齸鲛麁鴄鲘麈龇龆麁鴄齸鷴齝龇龆麁鴄鲔麢黤鲒鴈鶮鸩麍鶜鸨

Drupal\Core\Language\LanguageInterface

鲛麍鶜鹞鹫鹝麸鼛麽鲑齸鲨鸌鸀黕黑麸鼛鸮鶕齸鴒麽鸌鸀齼龡鲐鲎黂鲊鷪齓鲆鹫齸齲鷅麽鲑鳐鳌鸫鸩鸨

const LANGCODE_SYSTEM = 'system';

鱛鶶drupal鱚鸋鸊黽鸍鸌龓龇龆齸鼗黻麹鱖龗龇龆齸黐黍麹鵮龇齸鳶麏鵮龇鱒麈麻鲨鱎鱊龓鱆鹖龇龆鳴鳊黐黍鵮龇麹鼒麻鱎鱊龓鳃齸麢黤鴠鷦鱚鸋鸊龇龆鹱鵮龇龓鴠鹗

const LANGCODE_NOT_SPECIFIED = 'und';

龇龆鱁鱛鹞齸鳶齤齣鼊鼉鸽鸺麹齝龇龆鲠麚龓齸鼍鰾鰺齝鱛鹞龇龆齸鰷鸌齲麭麽鲑黂鶶

const LANGCODE_NOT_APPLICABLE = 'zxx';

鳶鰭鸽鸺鰺齝龇龆鲠麚鳴齸鼗黻麹鼒鰫鸌鰩鰦龇龆齸鰷鸌鲛麽鲑黂鶶

const LANGCODE_DEFAULT = 'x-default';

鸌鸀鱛鹞齼龵龓黐黍龇龆鳊鱚龇龆鳃齸麽鰡齼龡鲐鲎齸齝鳴鰝齤齣鼒鼊鼉鰭齼龵龓鱚龇龆麹鰙鰗齸鰓鰗黻鸌齲麭麽鲑齸麻鶮麏鷿鰏鰡鱚龇龆龓龇龆鸋鸊鹗鲎齸鲸鲰龓鸽鸺鲒鼝黽鶅齝鼝鶅

const LANGCODE_SITE_DEFAULT = 'site_default';

黂鶶鰎鰍龓黐黍龇龆

const STATE_CONFIGURABLE = 1;

鱛龇龆龓麻鰋鰇鰅鰂齸龇龆麁鴄麻鶮麹鷪麭鲒鼝齸麻鶮鰀鯽鷪鷅鰋鰇齸鲛麽鲑鱛鸋麻鰋鰇麚

const STATE_LOCKED = 2;

龇龆龓鯷鹞鰅鰂齸齝鷅龇龆麹鼒麻鶮鲨鸍鸌龓齸鸫齝鷅龇龆麁鴄黂鶶鱁鹞鹫鷈鼒鰫鯵齸鲭鶩鸌龇龆麁鴄鯳鸋黂鸿齸鼍鸿麹鯷鹞龓

const STATE_ALL = 3;

麢黤黕黑黽鷴齝龇龆鳴齸鸌鲛麽鲑黂鶶

const STATE_SITE_DEFAULT = 4;

鱛鸋龇龆麁鴄麹鯯麈鰎鰍黐黍龇龆

const TYPE_CONTENT = 'language_content';

const TYPE_INTERFACE = 'language_interface';

const TYPE_URL = 'language_url';

鶮齦鯬麭麽鲑鸌鸀鱛鸋龇龆鲨鸌鸀龓鯩鯨鼄鯧鸨鸽鸺鶙黰鯥鶙鯡麍

const DIRECTION_LTR = 'ltr';

const DIRECTION_RTL = 'rtl';

鶮齦鳳麭麽鲑鱛鸋龇龆龓鷒鹏鶕鷉

龇龆麁鴄鯞鯜鯘龇龆龓鷪鷅鲟鲜齸齝鲎鷁鶙龇龆鸋鸊鶙鷒鹏鶕鷉鶌鶌齸鸌鶮鸩鶕鶒鯗鯓鸨

public function getName();

鲢鷖鼈鼄麻鸱龓龇龆鲎鷁齸鵮龇鶕鷷

public function getId();

鲢鷖龇龆麁鴄龓龇龆鸋鸊齸鲛鸋鸊麽鸌鸀齼龡鲐鲎齸麹龇龆龓鹄鷽黂鶶齸鸇鸃鸀龇龆鹛鹗鹖鹕齸麹鷿鹄鷽鷹鷷齸鷴齝龇龆龓龇龆鸋鸊鷲龇龆鹖鹕龓鷮鷪鷧鷦鹱麻鷥龓鷿鷣鷧鷦鷢鷡

public function getDirection();

鲢鷖龇龆龓鷒鹏鶕鷉齸鷛鷚鷖鷓鷈鲼鷛鷓鷖鷚齸鯏鯋鯊鹞鹫齴麍鶜龓鶕鷉麽鲑鯇

public function getWeight();

鲢鷖龇龆龓鶣鶟鯊齸鸌鸀齴鯂鹹黰鯥黽龇龆鶣鶟齸鯊鮿鼃鮿鶣鲸鯥

public function isDefault();

鮽鮺鲛龇龆麁鴄麹鯯麈鰎鰍黐黍龇龆齸鸽鷧鴒鵫黐黍龇龆鰋鰇鸇鴿鮸

public function isLocked();

鮽鮺龇龆麁鴄麹鯯麹鯷鹞龓

黕黑黋黈鹝鷪麭黐黍龓龇龆麁鴄鸨

Drupal\Core\Language\Language

鸿龓鷢鮶鶕鶒鶮齼龡鶕鷷麍鮳鶮齦黋鷖龓鰓鷅龇龆鲟鲜齸齴鲒鮱鷽鸿鳴鮮鮬鮫鮪麹黋黈鷪麭鷎鲆齝龇龆id龓齼龡鳊鴒麽鼗麹齲鰗鰡龓鳃齸id鯊麈龇龆鸋鸊齸鸿鶅鴒鵫黐黍龇龆黅黂鸇鮨鮤鷿鷣鲟鲜齸鲛黐黍龇龆黅黂鷪鮡鮠鮜鹝95齓麽鸌龇龆鮛鶮龇龆鸋鸊龓鷁鮘鮔鶟鶣鶟齸鷲鶮鸩鶕鶒黋黈鸨

Drupal\Core\Language\LanguageManager::getStandardLanguageList();

鸫鸩黅齊鶮鲴鮐鮎鸨

[
      'af' => ['Afrikaans', 'Afrikaans'],
      'am' => ['Amharic', 'አማርኛ'],
      'ar' => ['Arabic', /* Left-to-right marker "‭" */ 'العربية', LanguageInterface::DIRECTION_RTL],
      'ast' => ['Asturian', 'Asturianu'],
      'az' => ['Azerbaijani', 'Azərbaycanca'],
      'be' => ['Belarusian', 'Беларуская'],
      'bg' => ['Bulgarian', 'Български'],
      'bn' => ['Bengali', 'বাংলা'],
      'bo' => ['Tibetan', 'བོད་སྐད་'],
      'bs' => ['Bosnian', 'Bosanski'],
      'ca' => ['Catalan', 'Català'],
      'cs' => ['Czech', 'Čeština'],
      'cy' => ['Welsh', 'Cymraeg'],
      'da' => ['Danish', 'Dansk'],
      'de' => ['German', 'Deutsch'],
      'dz' => ['Dzongkha', 'རྫོང་ཁ'],
      'el' => ['Greek', 'Ελληνικά'],
      'en' => ['English', 'English'],
      'en-x-simple' => ['Simple English', 'Simple English'],
      'eo' => ['Esperanto', 'Esperanto'],
      'es' => ['Spanish', 'Español'],
      'et' => ['Estonian', 'Eesti'],
      'eu' => ['Basque', 'Euskera'],
      'fa' => ['Persian, Farsi', /* Left-to-right marker "‭" */ 'فارسی', LanguageInterface::DIRECTION_RTL],
      'fi' => ['Finnish', 'Suomi'],
      'fil' => ['Filipino', 'Filipino'],
      'fo' => ['Faeroese', 'Føroyskt'],
      'fr' => ['French', 'Français'],
      'fy' => ['Frisian, Western', 'Frysk'],
      'ga' => ['Irish', 'Gaeilge'],
      'gd' => ['Scots Gaelic', 'Gàidhlig'],
      'gl' => ['Galician', 'Galego'],
      'gsw-berne' => ['Swiss German', 'Schwyzerdütsch'],
      'gu' => ['Gujarati', 'ગુજરાતી'],
      'he' => ['Hebrew', /* Left-to-right marker "‭" */ 'עברית', LanguageInterface::DIRECTION_RTL],
      'hi' => ['Hindi', 'हिन्दी'],
      'hr' => ['Croatian', 'Hrvatski'],
      'ht' => ['Haitian Creole', 'Kreyòl ayisyen'],
      'hu' => ['Hungarian', 'Magyar'],
      'hy' => ['Armenian', 'Հայերեն'],
      'id' => ['Indonesian', 'Bahasa Indonesia'],
      'is' => ['Icelandic', 'Íslenska'],
      'it' => ['Italian', 'Italiano'],
      'ja' => ['Japanese', '日本語'],
      'jv' => ['Javanese', 'Basa Java'],
      'ka' => ['Georgian', 'ქართული ენა'],
      'kk' => ['Kazakh', 'Қазақ'],
      'km' => ['Khmer', 'ភាសាខ្មែរ'],
      'kn' => ['Kannada', 'ಕನ್ನಡ'],
      'ko' => ['Korean', '한국어'],
      'ku' => ['Kurdish', 'Kurdî'],
      'ky' => ['Kyrgyz', 'Кыргызча'],
      'lo' => ['Lao', 'ພາສາລາວ'],
      'lt' => ['Lithuanian', 'Lietuvių'],
      'lv' => ['Latvian', 'Latviešu'],
      'mg' => ['Malagasy', 'Malagasy'],
      'mk' => ['Macedonian', 'Македонски'],
      'ml' => ['Malayalam', 'മലയാളം'],
      'mn' => ['Mongolian', 'монгол'],
      'mr' => ['Marathi', 'मराठी'],
      'ms' => ['Bahasa Malaysia', 'بهاس ملايو'],
      'my' => ['Burmese', 'ဗမာစကား'],
      'ne' => ['Nepali', 'नेपाली'],
      'nl' => ['Dutch', 'Nederlands'],
      'nb' => ['Norwegian Bokmål', 'Norsk, bokmål'],
      'nn' => ['Norwegian Nynorsk', 'Norsk, nynorsk'],
      'oc' => ['Occitan', 'Occitan'],
      'pa' => ['Punjabi', 'ਪੰਜਾਬੀ'],
      'pl' => ['Polish', 'Polski'],
      'pt-pt' => ['Portuguese, Portugal', 'Português, Portugal'],
      'pt-br' => ['Portuguese, Brazil', 'Português, Brasil'],
      'ro' => ['Romanian', 'Română'],
      'ru' => ['Russian', 'Русский'],
      'sco' => ['Scots', 'Scots'],
      'se' => ['Northern Sami', 'Sámi'],
      'si' => ['Sinhala', 'සිංහල'],
      'sk' => ['Slovak', 'Slovenčina'],
      'sl' => ['Slovenian', 'Slovenščina'],
      'sq' => ['Albanian', 'Shqip'],
      'sr' => ['Serbian', 'Српски'],
      'sv' => ['Swedish', 'Svenska'],
      'sw' => ['Swahili', 'Kiswahili'],
      'ta' => ['Tamil', 'தமிழ்'],
      'ta-lk' => ['Tamil, Sri Lanka', 'தமிழ், இலங்கை'],
      'te' => ['Telugu', 'తెలుగు'],
      'th' => ['Thai', 'ภาษาไทย'],
      'tr' => ['Turkish', 'Türkçe'],
      'tyv' => ['Tuvan', 'Тыва дыл'],
      'ug' => ['Uyghur', /* Left-to-right marker "‭" */ 'ئۇيغۇرچە', LanguageInterface::DIRECTION_RTL],
      'uk' => ['Ukrainian', 'Українська'],
      'ur' => ['Urdu', /* Left-to-right marker "‭" */ 'اردو', LanguageInterface::DIRECTION_RTL],
      'vi' => ['Vietnamese', 'Tiếng Việt'],
      'xx-lolspeak' => ['Lolspeak', 'Lolspeak'],
      'zh-hans' => ['Chinese, Simplified', '简体中文'],
      'zh-hant' => ['Chinese, Traditional', '繁體中文'],
    ];

鲛黅黂麹鷪麭齼龡齸鲐鲎麈龇龆鸋鸊齸鲐鯊麈鷪麭饲饮齼龡鸨

鷮鷪麭饪饨麈龇龆龓鲎鷁齸鸌鵮龇黂鶶

鷮鶎麭饪饨鼗麹龇龆龓鲎鷁齸鸌鲛龇龆鸃饧黂鶶

鷮鯬麭饪饨麻鷥黋黈齸黂鶶鷒鹏鶕鷉齸鼒黋黈黐黍麈鷛鷚鷖鷓

黕黑黐黍龇龆鸨

齴鳗鳔龇龆龡鳒黽鹞鹫鹝鰎鰍黐黍龇龆饣饠齸鸌鶮鲢鷖鰎鰍龓黐黍龇龆麁鴄鸨

饣饠id: language.default

鼄鸨Drupal\Core\Language\LanguageDefault

鸿龓饜齼麹鷪麭齼龡齸麹鸺饚黽龓鷪麭饜齼鶛鲑齸鱛鶶鳶鳦鰎鰍龓黐黍龇龆鷝齴饖鳛饚黽鸌鶮鸩鸋鸊鲢鷖鲛饣饠鸨

\Drupal::service(饕language.default饒);

龇龆鯂鹹饚鸨

齴鳗鳔龇龆龡鳒黽鹞鹫鹝龇龆鯂鹹饚齸鼍鸿鲒鼼饎饌鷪麭饊鼄龓饇饃齸鶅鲨鳗鳔龇龆鵶鳂饀鹏齸黕黑餿麶鸍鸌龓龇龆鯂鹹饚麹Drupal\language\ConfigurableLanguageManager

鲛龇龆鯂鹹饚龓饣饠id鸨language_manager 鲢鷖鸿麻鸌\Drupal::languageManager()

齲鷪鳂鸽鸺齴龇龆鵶鳂黥鼮黽鳐鳌鳊core\modules\language鳃齸齲餾齂龇龆餻餺鶙龇龆鲒鼝鶌鹱龇龆餸餶龓鼛鶕鯥鸽鸺齸鲸鲰麏齝鷄鷂龓黥鼮齸鳧黥鼮麹饊餲齸鼃鵹鹝鳠鲸餯餭麻鶮鰀鯽麍鸩鸇龓齅鲤鹝鳙

鮨餪鼔齠鸨

1.餦鶕龭鼼鷽黥鼮龤餤鸨

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Language…

2.龴龰龭餦鶕麒鷢鸍鸌餟齓鼹餜龇龆齸鲎鷁鹱龇龆鸋鸊鸫鸩鸨

鵡鵟鵞龇ar鶙鹄鼝黽龤zh-hans鶙鵮龇en鶙鶒龇fr鶙鵜龇ru鶙鵧鵥鵣龇es

本书共88小节:

评论 (写第一个评论)