Skip to content

Commit

Permalink
fix: i18n custom block default lang setting (#212)
Browse files Browse the repository at this point in the history
* fix: i18n custom block default lang setting

* updates
  • Loading branch information
kazupon authored Nov 12, 2021
1 parent e0a30fe commit 0f033a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/infuser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function buildI18nTag (i18nBlock: SFCI18nBlock, options?: FormatOptions): string
}
if (lang !== 'json') {
tag += ` lang="${escape(lang)}"`
} else if (lang === undefined) { // default json
} else { // default json
tag += ` lang="json"`
}
tag += '>'
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/infuser.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {}
}
</i18n>
<i18n locale=\\"ja\\">
<i18n locale=\\"ja\\" lang=\\"json\\">
{
\\"headers\\": {
\\"rank\\": \\"ランク\\",
Expand Down Expand Up @@ -147,7 +147,7 @@ export default {}
}
</i18n>
<i18n locale=\\"en\\">
<i18n locale=\\"en\\" lang=\\"json\\">
{
\\"id\\": \\"User ID\\",
\\"password\\": \\"Password\\",
Expand Down
18 changes: 9 additions & 9 deletions test/commands/__snapshots__/infuse.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ exports[`absolute path: /path/to/project1/src/components/nest/RankingTable.vue 1
</i18n>
<i18n locale=\\"ja\\">
<i18n locale=\\"ja\\" lang=\\"json\\">
{
\\"headers\\": {
\\"rank\\": \\"ランク\\",
Expand Down Expand Up @@ -103,7 +103,7 @@ exports[`absolute path: /path/to/project1/src/pages/Login.vue 1`] = `
</i18n>
<i18n locale=\\"en\\">
<i18n locale=\\"en\\" lang=\\"json\\">
{
\\"id\\": \\"User ID\\",
\\"password\\": \\"Password\\",
Expand Down Expand Up @@ -209,7 +209,7 @@ Object {
</i18n>
<i18n locale=\\"ja\\">
<i18n locale=\\"ja\\" lang=\\"json\\">
{
\\"headers\\": {
\\"rank\\": \\"ランク\\",
Expand Down Expand Up @@ -239,7 +239,7 @@ Object {
</i18n>
<i18n locale=\\"en\\">
<i18n locale=\\"en\\" lang=\\"json\\">
{
\\"id\\": \\"User ID\\",
\\"password\\": \\"Password\\",
Expand Down Expand Up @@ -320,7 +320,7 @@ exports[`ignore option: /path/to/project1/src/components/nest/RankingTable.vue 1
</i18n>
<i18n locale=\\"ja\\">
<i18n locale=\\"ja\\" lang=\\"json\\">
{
\\"headers\\": {
\\"rank\\": \\"ランク\\",
Expand Down Expand Up @@ -401,7 +401,7 @@ exports[`match option: /path/to/project1/src/components/nest/RankingTable.vue 1`
</i18n>
<i18n locale=\\"ja\\">
<i18n locale=\\"ja\\" lang=\\"json\\">
{
\\"headers\\": {
\\"rank\\": \\"ランク\\",
Expand Down Expand Up @@ -434,7 +434,7 @@ exports[`match option: /path/to/project1/src/pages/Login.vue 1`] = `
</i18n>
<i18n locale=\\"en\\">
<i18n locale=\\"en\\" lang=\\"json\\">
{
\\"id\\": \\"User ID\\",
\\"password\\": \\"Password\\",
Expand Down Expand Up @@ -514,7 +514,7 @@ exports[`relative path: /path/to/project1/src/components/nest/RankingTable.vue 1
</i18n>
<i18n locale=\\"ja\\">
<i18n locale=\\"ja\\" lang=\\"json\\">
{
\\"headers\\": {
\\"rank\\": \\"ランク\\",
Expand Down Expand Up @@ -547,7 +547,7 @@ exports[`relative path: /path/to/project1/src/pages/Login.vue 1`] = `
</i18n>
<i18n locale=\\"en\\">
<i18n locale=\\"en\\" lang=\\"json\\">
{
\\"id\\": \\"User ID\\",
\\"password\\": \\"Password\\",
Expand Down

0 comments on commit 0f033a1

Please sign in to comment.