File tree Expand file tree Collapse file tree 5 files changed +25
-0
lines changed Expand file tree Collapse file tree 5 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1515</template >
1616
1717<script >
18+ import { updateLocale } from ' theme/utils/i18n-utils' ;
1819import GenericError from ' theme/components/GenericError.vue' ;
1920import AppStore from ' docc-render/stores/AppStore' ;
2021
@@ -24,5 +25,13 @@ export default {
2425 created () {
2526 AppStore .setAllLocalesAreAvailable ();
2627 },
28+ beforeRouteEnter (to , from , next ) {
29+ next ((vm ) => {
30+ updateLocale (to .params .locale , vm);
31+ });
32+ },
33+ beforeRouteUpdate (to ) {
34+ updateLocale (to .params .locale , this );
35+ },
2736};
2837 </script >
Original file line number Diff line number Diff line change 1313</template >
1414
1515<script >
16+ import { updateLocale } from ' theme/utils/i18n-utils' ;
1617import GenericError from ' theme/components/GenericError.vue' ;
1718import AppStore from ' docc-render/stores/AppStore' ;
1819
@@ -22,5 +23,13 @@ export default {
2223 created () {
2324 AppStore .setAllLocalesAreAvailable ();
2425 },
26+ beforeRouteEnter (to , from , next ) {
27+ next ((vm ) => {
28+ updateLocale (to .params .locale , vm);
29+ });
30+ },
31+ beforeRouteUpdate (to ) {
32+ updateLocale (to .params .locale , this );
33+ },
2534};
2635 </script >
Original file line number Diff line number Diff line change 2121</template >
2222
2323<script >
24+ import { updateLocale } from ' theme/utils/i18n-utils' ;
2425import {
2526 fetchDataForRouteEnter ,
2627 shouldFetchDataForRouteUpdate ,
@@ -80,13 +81,15 @@ export default {
8081 return ;
8182 }
8283 fetchDataForRouteEnter (to, from, next).then (data => next ((vm ) => {
84+ updateLocale (to .params .locale , vm);
8385 vm .topicData = data; // eslint-disable-line no-param-reassign
8486 })).catch (next);
8587 },
8688 beforeRouteUpdate (to , from , next ) {
8789 if (shouldFetchDataForRouteUpdate (to, from)) {
8890 fetchDataForRouteEnter (to, from, next).then ((data ) => {
8991 this .topicData = data;
92+ updateLocale (to .params .locale , this );
9093 next ();
9194 }).catch (next);
9295 } else {
Original file line number Diff line number Diff line change 1313</template >
1414
1515<script >
16+ import { updateLocale } from ' theme/utils/i18n-utils' ;
1617import {
1718 fetchDataForRouteEnter ,
1819 shouldFetchDataForRouteUpdate ,
@@ -54,13 +55,15 @@ export default {
5455 }
5556
5657 fetchDataForRouteEnter (to, from, next).then (data => next ((vm ) => {
58+ updateLocale (to .params .locale , vm);
5759 vm .topicData = data; // eslint-disable-line no-param-reassign
5860 })).catch (next);
5961 },
6062 beforeRouteUpdate (to , from , next ) {
6163 if (shouldFetchDataForRouteUpdate (to, from)) {
6264 fetchDataForRouteEnter (to, from, next).then ((data ) => {
6365 this .topicData = data;
66+ updateLocale (to .params .locale , this );
6467 next ();
6568 }).catch (next);
6669 } else {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import FetchError from 'docc-render/errors/FetchError';
1515
1616jest . mock ( 'docc-render/utils/theme-settings' , ( ) => ( {
1717 baseUrl : '/' ,
18+ getSetting : jest . fn ( ) ,
1819} ) ) ;
1920
2021const mockInstance = {
You can’t perform that action at this time.
0 commit comments