HTMLã«ãããè¨èªã³ã¼ã/è¨èªã¿ã° ã¡ã¢
ããã¯ãå½æ翻訳ã試ã¿ãéã®æ®éª¸ã§ããããã®ã¾ã¾æ®ãã¦ãããã¨ã«ãã¾ããåæã®ææ°çã®ç¿»è¨³ããhttp://www.w3.org/International/articles/language-tags/Overview.ja.php?changelang=jaã«ããã¾ãã®ã§ããã¡ããåç §ãã¦ãã ããã
以ä¸ã®Language tags in HTML and XMLã®æ訳ã¯2006-11-09ã«å·çããããã®ãå ã«ãã¦ãã¾ããå ã®æç« ã¯2009-12-09ã«æ´æ°ããã¾ãããä¸é¨æ å ±ãå¤ããªã£ã¦ãããã¾ãã¯é£ãéããçãã¦ãããã¨ã«çæãã¦ãã ãããã¾ããBCP 47ã¯ãã®æç« ã®å·çæç¹ã§RFC 4646ã§ããããRFC 5646ã«ãã£ã¦Obsoletesã¨ããã¦ãã¾ãã
Linuxã®ãã©ã³ãã«ã¿ãã°ãä½ã£ã¦ããã¡ã«ãããããã°langå±æ§ã£ã¦ã®ã¯ã©ãè¨è¿°ããã°ãããã ãããä½ãæéã¿ãããªãã®ã¯ãªãããªã¨æ¢ãã¦ããã¨ãããW3Cã®æç« ãè¦ã¤ããã®ã§ã¡ã¢ã
- Language tags in HTML and XML
- http://www.w3.org/International/articles/language-tags/
以ä¸ãæ©æ¢°è¨³ãã¢ãã«ããæ訳ãæ£ãã°ãã¤ã¤ãé©å½ã«è§£éããã¡ã¢ãæ£ç¢ºãªæ å ±ã¯åæãåç §ãã¦ãã ãã(-;
ãã¨ããªã³ã¯å ã¿ã¤ãã«ã§ãã§ã«æ°ã¥ãã¦ãã人ãããã¨æãã¾ããããã®è©±ã¯XMLã«ãããxml:langå±æ§ãå½ã¦ã¯ã¾ãã¾ãã
ã¾ããåæã¨ã¯è©±ãåå¾ããããã©ãæãã¦ããã¹ããã¤ã³ãã¯ã
Note that the HTML specification still recommends the use of RFC 1766 for identifying language but you should use RFC 4646 despite what the HTML specification currently says.
ã£ã¦ã¨ãããHTML4ã¯RFC 1766ãåç
§ãã¦ããããã©ããï¼ããããRFCã®æµåã«å¾ã£ã¦ï¼ããã¨ã¯é¢ä¿ãªããï¼ææ°ã®RFCã§ããï¼RFC 4646ãåç
§ãã¹ããã¨ããã¾ãã
ã¡ãªã¿ã«ãRFC 4646ã¯RFC 3066ã¨RFC 1766ãobsoleteï¼æ代é
ãï¼ã«ãã¦ãã¾ãã
ç´°ãã説æã¯å¾ã§ããã¨ãã¦ãè¨èªã¿ã°ã«ã¤ãã¦ã¯
The golden rule when creating language tags is to keep the tag as short as possible. Avoid region, script or other subtags except where they add useful distinguishing information. For instance, use ja for Japanese and not ja-JP, unless there is a particular reason that you need to say that this is Japanese as spoken in Japan.
ãããããªã¿ã°ã使ããããã©ããã§ããã ãçãããããã»ããããããã¨ãã°ãæ¥æ¬ã§è©±ãããæ¥æ¬èªã¨æ示ããå¿ è¦ããªããã°ãæ¥æ¬èªã«ja-JPã§ã¯ãªããjaã使ç¨ããããã«ãã¨ããã¾ãã
XML also provides a means to prevent inheritance of language using the empty string, ie.
xml:lang=""Essentially, this says: I do not want to associate any language with this information.
XMLã«ããã¦ã¯ãæååã空ã«ãããã¨ã§ãè¨èªæ å ±ã«çµã³ä»ããªãè¦ç´ ãæä¾ãããã¨ãã§ãããã¨ã®ãã¨ã
ããã¯è¨èªã³ã¼ããèªç¶è¨èªã®ã¿ã対象ã«ãã¦ãããã¨ããããã¦æ¸ããã¦ãããã®ããªã¨ãè¦ããã«ãJavascriptãªããã®ã¹ã¯ãªããè¨èªããCè¨èªãªããã®ããã°ã©ãã³ã°è¨èªãªã©ã人工è¨èªãè¨è¿°ãããããªå±é¢ã«ããã¦æå¹ãªæ段ã ãã¨è¨ãããã®ã§ãããã
ã¿ã°ã®çµã¿ç«ã¦
è¨èªã¿ã°ã¯ãsubã¿ã°ãçµã¿åããããã¨ã§ãããããªè¨èªã¿ã°ãä½ãåºããã¨ãã§ããããã©ããè¨èªã¿ã°ãæ§æããsubã¿ã°ã®åºç¾ããé çªã¯æ±ºã¾ã£ã¦ãã¦ã
language-script-region-variant-extension-privateuse
ã®ã¨ãããç¡çããæ¥æ¬èªè¨³ãããªãããè¨èª-ç¨å-å°å-ç°å½¢-æ¡å¼µ-ç§ç¨ãã¨ãã£ãæãã§ããããã
ãã¨ã
The entries in the registry follow certain conventions with regard to upper and lowercasing - for example, language tags are lower case, alphabetic region subtags are upper case, and script tags begin with an initial capital. This is only a convention! When you use these subtags you are free to do as you like.
subã¿ã°ã¯ãããã¿ã°ã¯å¤§æåã ã£ãããã¾ãããã¿ã°ã¯å°æåã ã£ãããããã©ãããã¯åãªãæ
£ç¿ã§ãã£ã¦ã大æåã ããã¨å°æåã ããã¨åºå¥ããæ±ããã¨ã®ãã¨ã
language subtag/è¨èªsubã¿ã°
All language tags must begin with a language subtag.
ãã¹ã¦ã®è¨èªã¿ã°ã¯è¨èªsubã¿ã°ã§å§ã¾ããªããã°ãªãã¾ããã
Examples of simple, language-only language tags include:
- en (English)
- ast (Asturian - no two-letter code exists for Asturian in the ISO lists)
ãæãã¦ãã¾ãã
ISO 639ã®è¨èªã³ã¼ãã¯2æåã®ãã®ã¨3æåã®ãã®ãããã®ã¯å¨ç¥ã®ã¨ããã ã¨æãã¾ãããããã«ã¤ãã¦ã¯ã
These codes come from, and are kept up to date with, ISO 639 language codes. Because RFC 3066 didn't provide a list of valid subtags and just referred users to ISO 639, there was sometimes confusion about how to tag languages when the ISO code lists contained both two-letter and three-letter codes (and sometimes more than one three-letter code). Now all valid subtags are listed in a single IANA registry, which adopts only one value from the ISO lists per language. If a two-letter ISO code is available, this will be the one in the registry. Otherwise the registry will contain one three-letter code. This should make things simpler.
以åã®RFC 306ã¯ISO 639ãåç
§ãã¦ããã ããªã®ã§ã2æåã3æåãã©ã¡ãã使ã£ã¦ããã®ãæ··ä¹±ãããã¨ããã£ãï¼æã«ã¯2ã¤ä»¥ä¸ã®3æåã³ã¼ããããâãã¶ãISO 639-2ã®æ¸èªç¨ã®ãBã³ã¼ããã¨ç¨èªå¦ç¨ã®ãTã³ã¼ããã®2種é¡ã§éããã®ããããã¨ãããã¨ãè¨ãããã®ã ã¨æãï¼ãããã§ãIANAã®ã¬ã¸ã¹ããªãä½ãããã¡ããåç
§ããããã«ããã2æåã®ISOã³ã¼ãã¯ãã®ã¾ã¾ç»é²ããã2æåã®ã³ã¼ãããªããã°3æåã®ISOã³ã¼ããç»é²ãã¦ãããã¨ãããã¨ãããããããªã«è¤éã§ããªãæ°ã¯ãããã§ããã
script subtag/ç¨åsubã¿ã°
ç¨åï¼subï¼ã¿ã°ãå«ãè¨èªã¿ã°ã«é¢ããä¾ã¯
Examples of language tags including script tags are:
- zh-Hans (Simplified Chinese)
- az-Latn (Azerbaijani, written in Latin script - since Azerbaijani can also be written using the Arabic script)
æ¯è¼ç身è¿ãªä¾ã§ããzh-Hansï¼ç°¡ä½åä¸å½èªï¼ããªããRFC 4646ã§ä¸çªã®ç®çããªã¨ï¼å¾ã§ã説æï¼ã
The script subtag is new in RFC 4646. The subtags come from, and are kept up to date with, the list of ISO 15924 script codes.
Only one script subtag can appear in a language tag, and it must immediately follow the language subtag. It is always four letters long.
ç¨åã¿ã°ã¯RFC 4646ã§æ¡ç¨ãããæ°ãããã®ã§ãISO 15924ã³ã¼ãã®ææ°ãªã¹ããåç
§ãã¦ãã¾ãã
ãã®ã¿ã°ãå«ãè¨èªã¿ã°ã¯ãè¨èªsubã¿ã°ã®ç´å¾ã«4æåã®ç¨åsubã¿ã°ãç¶ãããã¨ã«ãªãã¾ãã
Although for common uses of language tags it is not likely that you will need to specify the script, there are one or two situations that have been crying out for it for some time. One such example is Chinese. There are many Chinese dialects, often mutually unintelligible, but these dialects are all written using either Simplified or Traditional Chinese script. People typically want to label Chinese text as either Simplified or Traditional, but until recently there was no way to do so. People had to bend something like zh-CN (meaning Chinese as spoken in China) to mean Simplified Chinese, even in Singapore, and zh-TW (meaning Chinese as spoken in Taiwan) for Traditional Chinese. Some people, however, use zh-HK for Traditional Chinese. The availability of zh-Hans and zh-Hant for Chinese written in Simplified and Traditional scripts should improve consistency and accuracy, and is already becoming widely used.
ç¨åãæ示ããå¿
è¦ã®ããè¨èªã¨ãã¦ãç°¡ä½åã¨ç¹ä½åã¨ãããä¸å½èªãæãããã¾ããããã¾ã§ç°¡ä½åã¨ç¹ä½åãåé¡ããæ段ãããã¾ããã§ããããã®ç¨åã³ã¼ããç¨ãããã¨ã§ãzh-Hansï¼ç°¡ä½åä¸å½èªï¼ãzh-Hantï¼ç¹ä½åä¸å½èªï¼ã¨æ示ãããã¨ãã§ãããã§ã«åºã使ç¨ããã¦ãã¾ããã¨ã®ãã¨ï¼ããªãè¦ç´ï¼ã
region subtag/å°åsubã¿ã°
å°åï¼subï¼ã¿ã°ãå«ãè¨èªã¿ã°ã«é¢ããä¾ã¯
Examples of language tags including region subtags include:
- en-GB (British English)
- es-005 (South American Spanish)
- zh-Hant-HK (Traditional Chinese as used in Hong Kong)
å°åã¿ã°ã«ã¤ãã¦ã¯ã
The region subtag in RFC 3066 took its values from the ISO 3166 country codes. These two-letter codes are still available from the new registry, but the registry also lists 3-digit UN M.49 region codes. The advantage of these codes is that they can represent more than just countries. For example, localization groups have for some time wanted to label their carefully crafted translations as Latin-American Spanish, rather than the Spanish of any particular country. With RFC 4646 this is now possible. (The appropriate language tag is es-419.)
ISO3166ï¼å³å¯ã«ã¯ISO3166-1ï¼ã®2æåã®å½ã³ã¼ããã¾ãã¯UN M.49ã®3æ¡ã®å°åã³ã¼ãã使ããããã®UN M.49ã¯å½ä»¥ä¸ã®æ¬ãããã¨ãã°ã©ãã³ã¢ããªã«ã¨ãã£ããããªæ¬ããå¯è½ã¨ã®ãã¨ã
ISO3166-2ï¼JIS X 0401ã®é½éåºçã³ã¼ããããï¼ãªããã¯ä½¿ç¨ãããã¨ãã§ããªã・・・大ã¾ããªå°åã«ã¯å¯¾å¿ãã¦ãã¦ããç´°ããå°åã«ã¯å¯¾å¿ããªãã®ãã
variant subtags/ç°å½¢subã¿ã°
It is unlikely that you will need to use variant subtags unless you are working in a specialised area.
The following examples may help you understand what these subtags do.
- sl-nedis (the Nadiza dialect of Slovenian)
- sl-rozaj (the Rezijan dialect of Slovenian)
- sl-IT-nedis (the specific variant of the Nadiza dialect of Slovenian that is spoken in Italy)
- de-CH-1901 (the variant of German orthography dating from the 1901 reforms, as seen in Switzerland)
å°éé åã«æºãããªã人ããç°å½¢ã¿ã°ã使ç¨ããå¿
è¦ãããã®ã¯ãã¾ããªãã§ãããã
以ä¸ã®ä¾ã¯ããã®ã¿ã°ãä½ãããããç解ããã®ãå©ããããããã¾ããã
- ã¹ãããã¢èªã®Nadizaæ¹è¨
- ã¹ãããã¢èªã®Rezijanæ¹è¨
- ã¤ã¿ãªã¢ã§è©±ãããSlovenianã®Nadizaæ¹è¨ã®ç¹å®ã®ç°å½¢
- ã¹ã¤ã¹ã§è¦ãããããã«1901å¹´ã®æ¹é©ãããã®ã¼ããã¤ãã®ç¶´ãåæ³ã®ç°å½¢
â¦ã¾ãããã£ã±ããããã¾ãããã
extension and private-use subtags/æ¡å¼µã»ç§ç¨subã¿ã°
We will mention these other subtags in passing, but if you feel you really need to use these tags, you should read the specification, rather than this article.
Extension subtags allow for future extensions to the language tag. There are no such registered tags at the moment.
Private-use subtags do not appear in the subtag registry, and are chosen and maintained by private agreement amongst parties.
Extension and private use tags are introduced by a single letter tag, or 'singleton'. The singleton for private use is x.
æ¬å½ã«ãããã®ã¿ã°ã使ç¨ããã®ãå¿
è¦ã§ããã¨æãããªããããªãã¯ãã®è¨äºãããããä»æ§ãèªãã¹ãã§ãã
æ¡å¼µã¿ã°ã¯è¨èªã¿ã°ã«ä»å¾ã®æ¡å¤§ãèæ
®ãã¾ãã ç¾å¨ããã®ãããªã©ããªç»é²ãããã¿ã°ãããã¾ããã
ç§ç¨ã¿ã°ã¯ããã¼ãã£ã¼ã§å人çãªåå®ã§subã¿ã°ç»é²ã«ç¾ããªãã§ãé¸ã°ãã¦ãã¦ãç¶æããã¾ãã
æ¡å¼µã»ç§ç¨ã¿ã°ã¯'x'ãé ã«ã¤ãã¾ãã
ãã¿ã§ja-x-2chï¼ï¼ã¡ããããèªï¼ã¨ãããããããã¾ããã
è¨èªã¿ã°ã®ãããã³ã°
Matching different language tags is important for a number of applications. According to BCP 47 'en' can be said to match 'en-GB'. For example, the following CSS code colors all English text red in browsers that support the pseudo-attribute :lang.
:lang(en) { color: red; }
å¤ãã®ã¢ããªã±ã¼ã·ã§ã³ã«ã¨ã£ã¦ãç°ãªã£ãè¨èªã¿ã°ããããã³ã°ããããã¨ã¯éè¦ã§ãã BCP47ã«ããã¨ã'en-GB'ãåãããã¨'en'ãè¨ããã¨ãã§ãã¾ãã ä¾ãã°ã以ä¸ã®CSSã³ã¼ãã¯ãã¹ã¦ã®è±æãçä¼¼å±æ§ã:langã§ããã¨ãµãã¼ããããã©ã¦ã¶ã®èµ¤ã«çè²ãã¾ãã
In the following code, the text described as lang="en-GB" will be red.
<p>En janvier, toutes les boutiques de Londres affichent des panneaux <span lang="en-GB">SALE</span>, mais en fait ces magasins sont bien propres!</p>
ãã®ã³ã¼ãã§ã¯ãlang="en-GB"ã¨ãã¦è¨è¿°ãããããã¹ãã¯èµ¤ããªãã§ãããã
On the other hand, given the following CSS declaration,
:lang(en-GB) { color: red; }the word 'SALE' should not be red in the following code.
<p>En janvier, toutes les boutiques de Londres affichent des panneaux <span lang="en">SALE</span>, mais en fait ces magasins sont bien propres!</p>
ãã®CSS宣è¨ã«ããã¦ã'SALE'ã¨ããåèªã¯ä»¥ä¸ã®ã³ã¼ãã§èµ¤ãã¹ãã§ã¯ããã¾ããã
â¦CSS2ã«ããã»ã¬ã¯ã¿ã ã£ããããããã§ãããå¤ãIEã¯ãµãã¼ããã¾ããã
åèè³æ
ãã®ãã¼ã¸ãä½æããã«ããã£ã¦ã®åèãã¼ã¸ã¨ã