This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): Added support for custom import names
import x, { i18nGroup as y } from 'es2015-i18n-tag' is now detected by i18n-tag-schema
- Loading branch information
Showing
4 changed files
with
52 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
@i18nGroup('custom group') | ||
import i18nc, { i18nGroup as e } from 'es2015-i18n-tag' | ||
|
||
@e('custom group') | ||
export class Test { | ||
log() { | ||
console.log(this.i18n`Hello ${name}, you have ${amount}:c in your bank account.`) | ||
console.log(i18n('custom inline group') `Hello!`) | ||
console.log(i18nc('custom inline group') `Hello!`) | ||
console.log(this.i18n('custom inline group') `Welcome!`) | ||
|
||
console.log(i18n` | ||
console.log(i18nc` | ||
<users> | ||
${hello.map((item) => i18n` | ||
${hello.map((item) => i18nc` | ||
<user name="${item.name}">${item.percentage}:p</user> | ||
`).join('')} | ||
</users> | ||
`) | ||
|
||
} | ||
} | ||
} | ||
|
||
|
||
class TestX { | ||
log() { | ||
console.log(this.i18n`Hello ${name}, you have ${amount}:c in your bank account.`) | ||
console.log(i18n('custom inline group') `Hello!`) | ||
console.log(i18nc('custom inline group') `Hello!`) | ||
console.log(this.i18n('custom inline group') `Welcome!`) | ||
console.log(i18n(__translationGroup) `Hello!`) | ||
} | ||
console.log(i18nc(__translationGroup) `Hello!`) | ||
} | ||
} | ||
export default i18nGroup('custom group 2')(TestX) | ||
export default e('custom group 2')(TestX) | ||
|
||
@i18nGroup(__translationGroup) | ||
@e(__translationGroup) | ||
export class TestY { | ||
log() { | ||
console.log(this.i18n`Hello ${name}, you have ${amount}:c in your bank account.`) | ||
console.log(i18n('custom inline group') `Hello!`) | ||
console.log(i18nc('custom inline group') `Hello!`) | ||
console.log(this.i18n('custom inline group') `Welcome!`) | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import i18n, { i18nGroup } from 'es2015-i18n-tag' | ||
|
||
console.log(i18n` | ||
<users> | ||
${hello.map((item) => i18n` | ||
|
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