Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(i18n): support basic il8n feature #170

Merged
merged 9 commits into from
Jun 8, 2021
Merged

feat(i18n): support basic il8n feature #170

merged 9 commits into from
Jun 8, 2021

Conversation

wewoor
Copy link
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
src/extensions/editor/index.tsx Outdated Show resolved Hide resolved
src/i18n/localization.ts Outdated Show resolved Hide resolved
src/i18n/localeService.ts Outdated Show resolved Hide resolved
src/i18n/localeService.ts Outdated Show resolved Hide resolved
src/i18n/localeService.ts Outdated Show resolved Hide resolved
src/controller/statusBar.tsx Outdated Show resolved Hide resolved
src/i18n/localeService.ts Outdated Show resolved Hide resolved
src/i18n/localize.tsx Outdated Show resolved Hide resolved
@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
3 participants