C# 클래스 SIL.CoreImpl.LangTagUtils

This static utility class contains various methods for processing RFC-5646 language tags. The methods defined in this class can currently only support language tags with a single variant subtag and no extensions.
파일 보기 프로젝트 열기: sillsdev/FieldWorks

공개 메소드들

메소드 설명
GetCodes ( string langTag, string &languageCode, string &scriptCode, string &regionCode, string &variantCode ) : bool

Gets the codes of the specified language tag.

GetLanguageSubtag ( string code ) : LanguageSubtag

Gets the language subtag with the specified code.

GetPrivateUseAndStandardVariant ( string wholeVariant, string &standardVariant ) : string

Standard way to split a Variant into the standard-variant part (before any -x-, or empty if it starts with x-) and the private-use part (after the x part, or empty if there is no x). Returns the private use part.

GetRegionSubtag ( string code ) : RegionSubtag

Gets the region subtag with the specified code.

GetRegionSubtag ( string code, string name ) : RegionSubtag

Get a region subtag with the specified code and name. If it is a standard region, the name passed in will be ignored, and the standard name used. If not, it will have the specified name and code, and be marked private use.

GetScriptSubtag ( string code ) : ScriptSubtag

Gets the script subtag with the specified code.

GetScriptSubtag ( string code, string name ) : ScriptSubtag

Gets the script subtag with the specified code. If it is not a known code, returns a private-use tag with the specified name and code; if it is known, the supplied name is ignored.

GetSubtags ( string langTag, LanguageSubtag &languageSubtag, ScriptSubtag &scriptSubtag, RegionSubtag &regionSubtag, VariantSubtag &variantSubtag ) : bool

Gets the subtags of the specified language tag.

GetVariantSubtag ( string code ) : VariantSubtag

Gets the variant subtag with the specified code.

GetVariantSubtag ( string code, string name, IEnumerable prefixes ) : VariantSubtag

Gets the variant subtag with the specified code. If it is not a known (non-private-use) one, make a private-use one with the specified values. Insert 'x' or move it earlier if any leading parts are not standard.

IsLanguageCodeValid ( string code ) : bool

Determines whether the specified language code is valid.

IsPrivateUseRegionCode ( string regionCode ) : bool

Determines whether the specified region code is private use.

IsRegionCodeValid ( string code ) : bool

Determines whether the specified region code is valid.

IsScriptCodeValid ( string code ) : bool

Determines whether the specified script code is valid.

IsValid ( string langTag ) : bool

Determines whether the specified language tag is valid.

IsVariantCodeValid ( string code ) : bool

Determines whether the specified variant code is valid.

ToIcuLocale ( LanguageSubtag languageSubtag, ScriptSubtag scriptSubtag, RegionSubtag regionSubtag, VariantSubtag variantSubtag ) : string

Generates an ICU locale from the specified language tag subtags.

ToIcuLocale ( string langTag ) : string

Converts the specified language tag to an ICU locale.

ToIcuLocale ( string languageCode, string scriptCode, string regionCode, string variantCode ) : string

Generates an ICU locale from the specified language tag codes.

ToLangTag ( LanguageSubtag languageSubtag, ScriptSubtag scriptSubtag, RegionSubtag regionSubtag, VariantSubtag variantSubtag ) : string

Generates a language tag from the specified subtags.

ToLangTag ( string icuLocale ) : string

Converts the specified ICU locale to a language tag. If the ICU locale is already a valid language tag, it will return it.

ToLangTag ( string languageCode, string scriptCode, string regionCode, string variantCode ) : string

Generates a language tag from the specified codes.

비공개 메소드들

메소드 설명
LangTagUtils ( ) : System
NextSubTag ( string subTags, int &subTagIndex, bool &privateUsePrefix ) : string
TranslateVariantCode ( string variantCode, string>.Func defaultFunc ) : string

Translates standard variant codes to their expanded (semi-human-readable) format; all others are translated using the given function.

TreatAsCustomRegion ( string regionCode ) : bool
TreatAsCustomScript ( string scriptCode ) : bool

메소드 상세

GetCodes() 공개 정적인 메소드

Gets the codes of the specified language tag.
public static GetCodes ( string langTag, string &languageCode, string &scriptCode, string &regionCode, string &variantCode ) : bool
langTag string The lang tag.
languageCode string The language code.
scriptCode string The script code.
regionCode string The region code.
variantCode string The variant code.
리턴 bool

GetLanguageSubtag() 공개 정적인 메소드

Gets the language subtag with the specified code.
public static GetLanguageSubtag ( string code ) : LanguageSubtag
code string The code.
리턴 LanguageSubtag

GetPrivateUseAndStandardVariant() 공개 정적인 메소드

Standard way to split a Variant into the standard-variant part (before any -x-, or empty if it starts with x-) and the private-use part (after the x part, or empty if there is no x). Returns the private use part.
public static GetPrivateUseAndStandardVariant ( string wholeVariant, string &standardVariant ) : string
wholeVariant string
standardVariant string
리턴 string

GetRegionSubtag() 공개 정적인 메소드

Gets the region subtag with the specified code.
public static GetRegionSubtag ( string code ) : RegionSubtag
code string The code.
리턴 RegionSubtag

GetRegionSubtag() 공개 정적인 메소드

Get a region subtag with the specified code and name. If it is a standard region, the name passed in will be ignored, and the standard name used. If not, it will have the specified name and code, and be marked private use.
public static GetRegionSubtag ( string code, string name ) : RegionSubtag
code string
name string
리턴 RegionSubtag

GetScriptSubtag() 공개 정적인 메소드

Gets the script subtag with the specified code.
public static GetScriptSubtag ( string code ) : ScriptSubtag
code string The code.
리턴 ScriptSubtag

GetScriptSubtag() 공개 정적인 메소드

Gets the script subtag with the specified code. If it is not a known code, returns a private-use tag with the specified name and code; if it is known, the supplied name is ignored.
public static GetScriptSubtag ( string code, string name ) : ScriptSubtag
code string
name string
리턴 ScriptSubtag

GetSubtags() 공개 정적인 메소드

Gets the subtags of the specified language tag.
public static GetSubtags ( string langTag, LanguageSubtag &languageSubtag, ScriptSubtag &scriptSubtag, RegionSubtag &regionSubtag, VariantSubtag &variantSubtag ) : bool
langTag string The language tag.
languageSubtag LanguageSubtag The language subtag.
scriptSubtag ScriptSubtag The script subtag.
regionSubtag RegionSubtag The region subtag.
variantSubtag VariantSubtag The variant subtag.
리턴 bool

GetVariantSubtag() 공개 정적인 메소드

Gets the variant subtag with the specified code.
public static GetVariantSubtag ( string code ) : VariantSubtag
code string
리턴 VariantSubtag

GetVariantSubtag() 공개 정적인 메소드

Gets the variant subtag with the specified code. If it is not a known (non-private-use) one, make a private-use one with the specified values. Insert 'x' or move it earlier if any leading parts are not standard.
public static GetVariantSubtag ( string code, string name, IEnumerable prefixes ) : VariantSubtag
code string
name string
prefixes IEnumerable
리턴 VariantSubtag

IsLanguageCodeValid() 공개 정적인 메소드

Determines whether the specified language code is valid.
public static IsLanguageCodeValid ( string code ) : bool
code string The language code.
리턴 bool

IsPrivateUseRegionCode() 공개 정적인 메소드

Determines whether the specified region code is private use.
public static IsPrivateUseRegionCode ( string regionCode ) : bool
regionCode string The region code.
리턴 bool

IsRegionCodeValid() 공개 정적인 메소드

Determines whether the specified region code is valid.
public static IsRegionCodeValid ( string code ) : bool
code string The region code.
리턴 bool

IsScriptCodeValid() 공개 정적인 메소드

Determines whether the specified script code is valid.
public static IsScriptCodeValid ( string code ) : bool
code string The script code.
리턴 bool

IsValid() 공개 정적인 메소드

Determines whether the specified language tag is valid.
public static IsValid ( string langTag ) : bool
langTag string The language tag.
리턴 bool

IsVariantCodeValid() 공개 정적인 메소드

Determines whether the specified variant code is valid.
public static IsVariantCodeValid ( string code ) : bool
code string The variant code.
리턴 bool

ToIcuLocale() 공개 정적인 메소드

Generates an ICU locale from the specified language tag subtags.
public static ToIcuLocale ( LanguageSubtag languageSubtag, ScriptSubtag scriptSubtag, RegionSubtag regionSubtag, VariantSubtag variantSubtag ) : string
languageSubtag LanguageSubtag The language subtag.
scriptSubtag ScriptSubtag The script subtag.
regionSubtag RegionSubtag The region subtag.
variantSubtag VariantSubtag The variant subtag.
리턴 string

ToIcuLocale() 공개 정적인 메소드

Converts the specified language tag to an ICU locale.
public static ToIcuLocale ( string langTag ) : string
langTag string The language tag.
리턴 string

ToIcuLocale() 공개 정적인 메소드

Generates an ICU locale from the specified language tag codes.
public static ToIcuLocale ( string languageCode, string scriptCode, string regionCode, string variantCode ) : string
languageCode string The language code.
scriptCode string The script code.
regionCode string The region code.
variantCode string The variant code.
리턴 string

ToLangTag() 공개 정적인 메소드

Generates a language tag from the specified subtags.
public static ToLangTag ( LanguageSubtag languageSubtag, ScriptSubtag scriptSubtag, RegionSubtag regionSubtag, VariantSubtag variantSubtag ) : string
languageSubtag LanguageSubtag The language subtag.
scriptSubtag ScriptSubtag The script subtag.
regionSubtag RegionSubtag The region subtag.
variantSubtag VariantSubtag The variant subtag.
리턴 string

ToLangTag() 공개 정적인 메소드

Converts the specified ICU locale to a language tag. If the ICU locale is already a valid language tag, it will return it.
public static ToLangTag ( string icuLocale ) : string
icuLocale string The ICU locale.
리턴 string

ToLangTag() 공개 정적인 메소드

Generates a language tag from the specified codes.
public static ToLangTag ( string languageCode, string scriptCode, string regionCode, string variantCode ) : string
languageCode string The language code.
scriptCode string The script code.
regionCode string The region code.
variantCode string The variant code.
리턴 string