Types
LocaleProperties
包含完整 locale 信息的 TypeScript 接口
概述
LocaleProperties 提供关于某个 locale 的详细语言与区域信息。
interface LocaleProperties {
  code: string;
  name: string;
  nativeName: string;
  languageCode: string;
  languageName: string;
  nativeLanguageName: string;
  nameWithRegionCode: string;
  nativeNameWithRegionCode: string;
  regionCode: string;
  regionName: string;
  nativeRegionName: string;
  scriptCode: string;
  scriptName: string;
  nativeScriptName: string;
  maximizedCode: string;
  maximizedName: string;
  nativeMaximizedName: string;
  minimizedCode: string;
  minimizedName: string;
  nativeMinimizedName: string;
  emoji: string;
}由 getLocaleProperties 方法返回的结果。
关键属性
| Property | Description | 
|---|---|
| code | 原始语言代码 | 
| name | 源语言中的显示名称 | 
| nativeName | 本地语言的显示名称 | 
| languageCode | 基础语言代码 | 
| regionCode | ISO 地区代码 | 
| scriptCode | ISO 文字脚本代码 | 
| maximizedCode | 补全可能脚本/地区后的语言环境 | 
| minimizedCode | 最短有效语言代码 | 
| emoji | 旗帜表情符号 | 
示例
基本使用
const gt = new GT({ sourceLocale: 'en-US' });
const props = gt.getLocaleProperties('de-AT');
console.log(props.name);        // "奥地利德语"
console.log(props.nativeName);  // "Österreichisches Deutsch"
console.log(props.emoji);       // "🇦🇹"相关类型
- getLocaleProperties- 返回此接口的方式
这份指南怎么样?

