Skip to content

Instantly share code, notes, and snippets.

@vaibhavgehani
Created July 12, 2021 13:51
Show Gist options
  • Select an option

  • Save vaibhavgehani/4d4cfc0f2a8f942efcec5e3dbc60a077 to your computer and use it in GitHub Desktop.

Select an option

Save vaibhavgehani/4d4cfc0f2a8f942efcec5e3dbc60a077 to your computer and use it in GitHub Desktop.
<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