Skip to content

Commit

Permalink
Fix locale issue on LocaleProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
erfanmola committed Oct 10, 2023
1 parent a5d4c1b commit ae1a95a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erfanmola/televue",
"version": "0.1.4",
"version": "0.1.5",
"type": "module",
"files": [
"dist"
Expand Down
13 changes: 7 additions & 6 deletions src/providers/LocaleProvider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@
"yi", // Yiddish
];
const direction = rtlLocales.includes(props.locale) ? 'rtl' : 'ltr';
const finalLocale = props.locale || WebApp.initDataUnsafe.user?.language_code?.toString().toLowerCase() || 'en';
const finalDirection = props.direction || rtlLocales.includes(finalLocale) ? 'rtl' : 'ltr';
document.body.classList.add(direction);
document.body.classList.add(finalDirection);
provide('locale', props.locale || WebApp.initDataUnsafe.user?.language_code?.toString().toLowerCase() || 'en');
provide('direction', props.direction || direction);
provide('locale', finalLocale);
provide('direction', finalDirection);
</script>
<template>
<div :class="[
`tele-vue-direction-${ direction }`,
`tele-vue-locale-${ locale }`
`tele-vue-direction-${ finalDirection }`,
`tele-vue-locale-${ finalLocale }`
]">
<slot />
</div>
Expand Down

0 comments on commit ae1a95a

Please sign in to comment.