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

本书共63小节:

评论 (写第一个评论)