Created
July 12, 2021 13:51
-
-
Save vaibhavgehani/4d4cfc0f2a8f942efcec5e3dbc60a077 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <template> | |
| <ion-app> | |
| <ion-router-outlet /> | |
| </ion-app> | |
| </template> | |
| <script lang="ts"> | |
| import { IonApp, IonRouterOutlet } from '@ionic/vue'; | |
| import { defineComponent } from 'vue'; | |
| import { Device, DevicePlugin } from '@capacitor/device'; | |
| export default defineComponent({ | |
| name: 'App', | |
| mounted() { | |
| const device: DevicePlugin = Device; | |
| device.getLanguageCode().then((res) => { | |
| console.log('Default lang', res.value); | |
| if (res.value.includes('-')) { | |
| const language = res.value.split('-')[0]; | |
| this.$i18n.locale = language; | |
| } else { | |
| this.$i18n.locale = res.value; | |
| } | |
| }) | |
| }, | |
| components: { | |
| IonApp, | |
| IonRouterOutlet | |
| } | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment