Skip to content

feat(i18n): support basic il8n feature#170

Merged
wewoor merged 9 commits intomainfrom
feat/locals
Jun 8, 2021
Merged

feat(i18n): support basic il8n feature#170
wewoor merged 9 commits intomainfrom
feat/locals

Conversation

@wewoor
Copy link
Copy Markdown
Collaborator

@wewoor wewoor commented Jun 7, 2021

Description

增加基本的国际化功能;目前 model 数据如果需要支持 国际化,需要利用 extension 去初始化数据;

  1. built-in en, zh-CN locales;
  2. load the model data in extensions'

Resolved #106 , Resolved #107

注意:

所有 model 中的内置数据,需要用 函数包裹起来,而不是直接使用 const 声明,尤其是需要使用 localize 函数的,主要是防止 localize 无法正确获取初始化的�国际化配置文件,例如mo/model/workbench/search.tsx

export function builtInSearchActivityItem() {
    return {
        id: SEARCH_ACTIVITY_ITEM,
        name: localize(SEARCH_ACTIVITY_ITEM, 'Search'),
        iconName: 'codicon-search',
    };
}

防止加载该模块文件时,就执行了 localize 方法;

1. built-in en, zh-CN locales; 2. load the model data in extensions'

re #106, re #107
@wewoor wewoor requested a review from mortalYoung June 7, 2021 09:20
@wewoor wewoor self-assigned this Jun 7, 2021
@wewoor wewoor added this to the 0.9.0-alpha.3 milestone Jun 7, 2021
Comment thread src/extensions/editor/index.tsx Outdated
Comment thread src/i18n/localization.ts Outdated
Comment thread src/i18n/localeService.ts Outdated
Comment thread src/i18n/localeService.ts Outdated
Comment thread src/i18n/localeService.ts Outdated
Comment thread src/controller/statusBar.tsx Outdated
Comment thread src/i18n/localeService.ts Outdated
Comment thread src/i18n/localize.tsx Outdated
@wewoor wewoor merged commit ce3c202 into main Jun 8, 2021
@wewoor wewoor deleted the feat/locals branch June 8, 2021 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internationalize 国际化支持通过扩展的方式, 默认内置简体中文、英文切换 调研 Internationalize 国际化方案

3 participants