-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for fluent-vue (#652)
- Loading branch information
Showing
24 changed files
with
688 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"i18n-ally.localesPaths": "i18n", | ||
"i18n-ally.keystyle": "nested" | ||
} |
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 @@ | ||
global-key = Global value |
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,13 @@ | ||
{ | ||
"name": "basic", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@fluent/bundle": "^0.16.0", | ||
"fluent-vue": "^3.0.0-beta.16", | ||
"vue": "~2.6.12" | ||
}, | ||
"devDependencies": { | ||
"fluent-vue-loader": "^3.0.0-beta.16" | ||
} | ||
} |
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,64 @@ | ||
<template> | ||
<div> | ||
<!-- Methods --> | ||
<div>{{ $t('test') }}</div> | ||
<div>{{ $t('global-key') }}</div> | ||
<div v-bind="$ta('props')" /> | ||
|
||
<!-- Directive --> | ||
<div v-t:test /> | ||
<div v-t:greeting="{ name: username }" /> | ||
|
||
<!-- Component --> | ||
<i18n path="term" tag="span"> | ||
<template #tos-link="{ termsLinkText }"> | ||
<RouterLink to="/login/register"> | ||
{{ termsLinkText }} | ||
</RouterLink> | ||
</template> | ||
</i18n> | ||
|
||
<div> | ||
Plain text to extract | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useFluent } from 'fluent-vue' | ||
export default { | ||
setup() { | ||
const { $t } = useFluent() | ||
return { | ||
test: $t('test'), | ||
} | ||
}, | ||
computed: { | ||
username() { | ||
return this.$t('user-name') | ||
}, | ||
notExists() { | ||
return this.$t('wrong-key') | ||
}, | ||
plainText() { | ||
return 'Plain text in js to extract' | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<fluent locale="en"> | ||
user-name = World | ||
aria-key = Aria value | ||
# {$name} Name of current user | ||
greeting = | ||
Hello, {$name} | ||
.aria-label = Label value | ||
test = Test value | ||
props = | ||
.aria-label = Aria | ||
term = I accept {$tos-link} | ||
.terms-link-text = Term of Service | ||
</fluent> |
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,9 @@ | ||
import { FluentBundle } from '@fluent/bundle' | ||
import { createFluentVue } from 'fluent-vue' | ||
|
||
const bundle = new FluentBundle('en') | ||
|
||
export const fluent = createFluentVue({ | ||
locale: 'en', | ||
bundles: [bundle], | ||
}) |
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,11 @@ | ||
import Vue from 'vue' | ||
|
||
import { fluent } from './fluent' | ||
import App from './App.vue' | ||
|
||
Vue.use(fluent) | ||
|
||
new Vue({ | ||
el: '#root', | ||
render: (h) => h(App), | ||
}) |
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,4 @@ | ||
{ | ||
"i18n-ally.localesPaths": "i18n", | ||
"i18n-ally.keystyle": "nested" | ||
} |
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,10 @@ | ||
user-name = World | ||
aria-key = Aria value | ||
# {$name} Name of current user | ||
greeting = Hello, { $name } | ||
.aria-label = Label value | ||
test = Test value | ||
props = .aria-label = Aria | ||
.aria-label = Aria | ||
term = I accept { $tos-link } | ||
.terms-link-text = Term of Service |
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,10 @@ | ||
{ | ||
"name": "basic", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@fluent/bundle": "^0.16.0", | ||
"fluent-vue": "^3.0.0-beta.16", | ||
"vue": "~2.6.12" | ||
} | ||
} |
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,49 @@ | ||
<template> | ||
<div> | ||
<!-- Methods --> | ||
<div>{{ $t('test') }}</div> | ||
<div v-bind="$ta('props')" /> | ||
|
||
<!-- Directive --> | ||
<div v-t:test /> | ||
<div v-t:greeting="{ name: username }" /> | ||
|
||
<!-- Component --> | ||
<i18n path="term" tag="span"> | ||
<template #tos-link="{ termsLinkText }"> | ||
<RouterLink to="/login/register"> | ||
{{ termsLinkText }} | ||
</RouterLink> | ||
</template> | ||
</i18n> | ||
|
||
<div> | ||
Plain text to extract | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useFluent } from 'fluent-vue' | ||
export default { | ||
setup() { | ||
const { $t } = useFluent() | ||
return { | ||
test: $t('test'), | ||
} | ||
}, | ||
computed: { | ||
username() { | ||
return this.$t('user-name') | ||
}, | ||
notExists() { | ||
return this.$t('wrong-key') | ||
}, | ||
plainText() { | ||
return "Plain text in js to extract" | ||
}, | ||
}, | ||
} | ||
</script> |
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,9 @@ | ||
import { FluentBundle } from '@fluent/bundle' | ||
import { createFluentVue } from 'fluent-vue' | ||
|
||
const bundle = new FluentBundle('en') | ||
|
||
export const fluent = createFluentVue({ | ||
locale: 'en', | ||
bundles: [bundle], | ||
}) |
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,11 @@ | ||
import Vue from 'vue' | ||
|
||
import { fluent } from './fluent' | ||
import App from './App.vue' | ||
|
||
Vue.use(fluent) | ||
|
||
new Vue({ | ||
el: '#root', | ||
render: (h) => h(App), | ||
}) |
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.