File tree Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -28,27 +28,29 @@ Vue.mixin({
28
28
} )
29
29
30
30
let currentLocale = 'en'
31
- Object . defineProperty ( Vue . prototype , 'currentLocale' , {
32
- get ( ) {
33
- return currentLocale
34
- } ,
35
-
36
- set ( locale ) {
37
- if ( locale === 'en' ) {
38
- currentLocale = locale
39
- fluent . bundles = [ enBundle ]
40
- }
31
+ if ( ! Object . hasOwnProperty . call ( Vue . prototype , 'currentLocale' ) ) {
32
+ Object . defineProperty ( Vue . prototype , 'currentLocale' , {
33
+ get ( ) {
34
+ return currentLocale
35
+ } ,
36
+
37
+ set ( locale ) {
38
+ if ( locale === 'en' ) {
39
+ currentLocale = locale
40
+ fluent . bundles = [ enBundle ]
41
+ }
42
+
43
+ if ( locale === 'uk' ) {
44
+ currentLocale = locale
45
+ fluent . bundles = [ ukBundle ]
46
+ }
41
47
42
- if ( locale === 'uk' ) {
43
- currentLocale = locale
44
- fluent . bundles = [ ukBundle ]
48
+ // Not sure why this is needed with nuxt 2
49
+ for ( const component of components . keys ( ) ) {
50
+ component . $forceUpdate ( )
51
+ }
45
52
}
46
-
47
- // Not sure why this is needed with nuxt 2
48
- for ( const component of components . keys ( ) ) {
49
- component . $forceUpdate ( )
50
- }
51
- }
52
- } )
53
+ } )
54
+ }
53
55
54
56
export const supportedLocales = [ 'en' , 'uk' ]
You can’t perform that action at this time.
0 commit comments