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

本书共71小节:

评论 (写第一个评论)