Skip to content

Commit

Permalink
Rework locale change (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
Demivan authored Jun 11, 2021
1 parent 092e891 commit 059ce03
Show file tree
Hide file tree
Showing 31 changed files with 226 additions and 179 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ![fluent-vue logo | height=100](./docs/assets/logo.svg)
# ![fluent-vue logo | height=100](https://raw.githubusercontent.com/demivan/fluent-vue/HEAD/docs/assets/logo.svg)

[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/demivan/fluent-vue/Test)](https:/Demivan/fluent-vue/actions)
[![codecov](https://codecov.io/gh/Demivan/fluent-vue/branch/develop/graph/badge.svg?token=0JSSE94EGJ)](https://codecov.io/gh/Demivan/fluent-vue)
Expand All @@ -8,7 +8,7 @@

Internationalization plugin for Vue.js

`fluent-vue` is [Vue.js](https://vuejs.org) integration for [Fluent.js](https:/projectfluent/fluent.js) - JavaScript implementation of [Project Fluent](https://projectfluent.org)
`fluent-vue` is [Vue.js](https://vuejs.org) integration for [Fluent.js](https:/projectfluent/fluent.js) - JavaScript implementation of [Project Fluent](https://projectfluent.org)

## 🚀 Features

Expand Down
5 changes: 5 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
project:
default:
informational: true
1 change: 0 additions & 1 deletion docs/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const bundle = new FluentBundle('en', {
})

const fluent = createFluentVue({
locale: 'en',
bundles: [bundle],
})
// #endregion datefns
Expand Down
1 change: 0 additions & 1 deletion docs/howto/access-outside-of-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const bundle = new FluentBundle('en')
bundle.addResource(new FluentResource('hello-user = Hello, { $username }!'))

const fluent = createFluentVue({
locale: 'en',
bundles: [bundle],
})

Expand Down
2 changes: 1 addition & 1 deletion docs/instalation.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ enBundle.addResource(new FluentResource('key = World'))
enBundle.addResource(new FluentResource('another-key = Hello, {$name}'))

// Create plugin istance
// bundles - The current negotiated fallback chain of languages
const fluent = createFluentVue({
locale: 'en',
bundles: [enBundle, ukBundle]
})

Expand Down
1 change: 0 additions & 1 deletion examples/vue-2-vite-typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Vue.use(CompositionApi)
const bundle = new FluentBundle('en')

const fluent = createFluentVue({
locale: 'en',
bundles: [bundle]
})
Vue.use(fluent)
Expand Down
1 change: 0 additions & 1 deletion examples/vue-2-webpack/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import App from './App.vue'
const bundle = new FluentBundle('en')

const fluent = createFluentVue({
locale: 'en',
bundles: [bundle]
})
Vue.use(fluent)
Expand Down
1 change: 0 additions & 1 deletion examples/vue-3-parcel/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ bundle.addResource(
)

const fluent = createFluentVue({
locale: 'en',
bundles: [bundle]
})

Expand Down
1 change: 0 additions & 1 deletion examples/vue-3-vite-typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import App from './App.vue'
const bundle = new FluentBundle('en')

const fluent = createFluentVue({
locale: 'en',
bundles: [bundle]
})

Expand Down
1 change: 0 additions & 1 deletion examples/vue-3-vue-cli/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import App from './App.vue'
const bundle = new FluentBundle('en')

const fluent = createFluentVue({
locale: 'en',
bundles: [bundle]
})

Expand Down
6 changes: 3 additions & 3 deletions packages/fluent-vue/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ![fluent-vue logo | height=100](../../docs/assets/logo.svg)
# ![fluent-vue logo | height=100](https://raw.githubusercontent.com/demivan/fluent-vue/HEAD/docs/assets/logo.svg)

[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/demivan/fluent-vue/Test)](https:/Demivan/fluent-vue/actions)
[![codecov](https://codecov.io/gh/Demivan/fluent-vue/branch/develop/graph/badge.svg?token=0JSSE94EGJ)](https://codecov.io/gh/Demivan/fluent-vue)
Expand All @@ -8,7 +8,7 @@

Internationalization plugin for Vue.js

`fluent-vue` is [Vue.js](https://vuejs.org) integration for [Fluent.js](https:/projectfluent/fluent.js) - JavaScript implementation of [Project Fluent](https://projectfluent.org)
`fluent-vue` is [Vue.js](https://vuejs.org) integration for [Fluent.js](https:/projectfluent/fluent.js) - JavaScript implementation of [Project Fluent](https://projectfluent.org)

## 🚀 Features

Expand All @@ -30,4 +30,4 @@ Changes for each release are documented in the [CHANGELOG.md](https:

## 📄 License

[MIT License](https:/demivan/fluent-vue/blob/develop/LICENSE) © 2020-present [Ivan Demchuk](https:/demivan)
[MIT License](https:/demivan/fluent-vue/blob/develop/LICENSE) © 2020-present [Ivan Demchuk](https:/demivan)
13 changes: 4 additions & 9 deletions packages/fluent-vue/__tests__/changeLanguage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('language change', () => {
bundleUk = new FluentBundle('uk-UA')

fluent = createFluentVue({
locale: ['uk-UA', 'en-US'],
bundles: [bundleUk, bundleEn]
})
})
Expand Down Expand Up @@ -75,8 +74,7 @@ describe('language change', () => {
bundleUk = new FluentBundle('uk-UA')

const fluent = createFluentVue({
locale: 'uk-UA',
bundles: [bundleUk, bundleEn]
bundles: [bundleUk]
})

bundleEn.addResource(
Expand All @@ -100,7 +98,7 @@ describe('language change', () => {

expect(mounted.html()).toEqual('<a href="/foo">текст посилання</a>')

fluent.locale = 'en'
fluent.bundles = [bundleEn]

await nextTick()

Expand All @@ -113,7 +111,6 @@ describe('language change', () => {
bundleEn = new FluentBundle('en-US')

const fluent = createFluentVue({
locale: 'en-US',
bundles: [bundleEn]
})

Expand All @@ -138,8 +135,7 @@ describe('language change', () => {
expect(mounted.html()).toEqual('<a href="/foo">link text</a>')

// Act
fluent.bundles = fluent.bundles.concat(bundleUk)
fluent.locale = 'uk'
fluent.bundles = [bundleUk]

await nextTick()

Expand All @@ -153,7 +149,6 @@ describe('language change', () => {
bundleUk = new FluentBundle('uk-UA')

const fluent = createFluentVue({
locale: 'uk-UA',
bundles: [bundleUk, bundleEn]
})

Expand Down Expand Up @@ -194,7 +189,7 @@ describe('language change', () => {
'<div><span>текст посилання</span><span>Повідомлення</span></div>'
)

fluent.locale = 'en'
fluent.bundles = [bundleEn]

await nextTick()

Expand Down
1 change: 0 additions & 1 deletion packages/fluent-vue/__tests__/errorHandling.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('vue integration', () => {
)

const fluent = createFluentVue({
locale: 'en-US',
bundles: [bundle]
})

Expand Down
1 change: 0 additions & 1 deletion packages/fluent-vue/__tests__/vue/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('component', () => {
bundle = new FluentBundle('en-US')

fluent = createFluentVue({
locale: 'en-US',
bundles: [bundle]
})
})
Expand Down
1 change: 0 additions & 1 deletion packages/fluent-vue/__tests__/vue/composition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('composition api', () => {
)

fluent = createFluentVue({
locale: ['en'],
bundles: [bundleEn]
})
})
Expand Down
1 change: 0 additions & 1 deletion packages/fluent-vue/__tests__/vue/customComponents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('method', () => {
bundle = new FluentBundle('en-US')

fluent = createFluentVue({
locale: 'en-US',
bundles: [bundle]
})
})
Expand Down
1 change: 0 additions & 1 deletion packages/fluent-vue/__tests__/vue/directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('directive', () => {
bundle = new FluentBundle('en-US')

fluent = createFluentVue({
locale: 'en-US',
bundles: [bundle]
})
})
Expand Down
Loading

0 comments on commit 059ce03

Please sign in to comment.