diff --git a/packages/uni-cli-i18n/__tests__/translate.spec.js b/packages/uni-cli-i18n/__tests__/translate.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..158761855a718a66bd29dad3008261bf88001b86 --- /dev/null +++ b/packages/uni-cli-i18n/__tests__/translate.spec.js @@ -0,0 +1,14 @@ +describe('translate', () => { + it('mustacheConfig', () => { + const i18n = require('../lib/index') + i18n.configure({ + staticCatalog: { + en: { + test: 'test {0}' + } + } + }) + i18n.setLocale('en') + expect(i18n.__('test', { '0': 'test' })).toBe('test test') + }) +}) diff --git a/packages/uni-cli-i18n/lib/index.js b/packages/uni-cli-i18n/lib/index.js index c78a0d996e2e886b742d07247629956e1f491aa2..5e991ca107948485f7797285eed47df02890122e 100644 --- a/packages/uni-cli-i18n/lib/index.js +++ b/packages/uni-cli-i18n/lib/index.js @@ -27,6 +27,10 @@ i18n.configure({ staticCatalog, defaultLocale, retryInDefaultLocale: true, + mustacheConfig: { + tags: ['{', '}'], + disable: false + }, fallbacks: { 'en_*': 'en', 'zh': 'zh_CN',