-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 资产国际化更改为 must 方案 & basic 包国际化完成
- Loading branch information
yangzy0603
committed
Jun 27, 2023
1 parent
6c81055
commit f6fbe5a
Showing
169 changed files
with
3,146 additions
and
1,117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// more config: http://gitlab.alibaba-inc.com/parrot/parrot-tool-must/blob/master/doc/config.md | ||
module.exports = { | ||
extract: { | ||
name: 'basic', | ||
sourcePath: 'src', | ||
fileType: 'ts', | ||
prettier: true, | ||
exclude: (path)=>{ | ||
return path.includes('/pages/') ; // | ||
}, | ||
macro: { | ||
path: 'src/i18n', | ||
method: '$i18n.get({id:"$key$",dm:"$defaultMessage$"})', | ||
import: 'import $i18n from "src/i18n"', | ||
keySplitter: '.', | ||
placeholder: variable => { | ||
return `{${variable}}`; | ||
}, | ||
implement: `import locale from '@aligov/global-locale'; | ||
import stringFormat from '@aligov/global-string-format'; | ||
import strings from './strings'; | ||
let language; // Current language | ||
let intl; // Instance of intl-universal. Create by provideIntl | ||
function update() { | ||
const { lang } = locale.getLocale(); | ||
language = lang; | ||
intl = stringFormat.init(lang, strings, { name: 'basic' }); | ||
} | ||
function change(langTag) { | ||
locale.setLang(langTag); | ||
update(); | ||
} | ||
function get(id, variable = {}) { | ||
if (!intl) update(); | ||
if (typeof id === 'string') { | ||
return stringFormat.format( | ||
{ | ||
id: id, | ||
}, | ||
variable, | ||
{ name: 'basic' } | ||
); | ||
} else if (typeof id === 'object' && id.dm) { | ||
id.defaultMessage = id.dm; | ||
} | ||
return stringFormat.format( | ||
{ | ||
id: id.id, | ||
defaultString: id.dm, | ||
}, | ||
variable, | ||
{ name: 'basic' } | ||
); | ||
} | ||
export default { | ||
get, | ||
update, | ||
change, | ||
language, | ||
}; | ||
`, | ||
dependencies: ['@aligov/global-locale', '@aligov/global-string-format'], | ||
}, | ||
babel: { | ||
allowImportExportEverywhere: true, | ||
decoratorsBeforeExport: true, | ||
plugins: [ | ||
'asyncGenerators', | ||
'classProperties', | ||
'decorators-legacy', | ||
'doExpressions', | ||
'exportExtensions', | ||
'exportDefaultFrom', | ||
'typescript', | ||
'functionSent', | ||
'functionBind', | ||
'jsx', | ||
'objectRestSpread', | ||
'dynamicImport', | ||
'numericSeparator', | ||
'optionalChaining', | ||
'optionalCatchBinding', | ||
], | ||
}, | ||
isNeedUploadCopyToMedusa: false, | ||
sourceLang: 'zh-CN', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 18 additions & 5 deletions
23
packages/gi-assets-basic/src/components/ActivateRelations/info.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.