mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 21:45:25 +02:00
Feature/auto generate crowdin data (#1071)
* add translated key * update code generation for crowdin generation * use composition api and minor styling changes
This commit is contained in:
parent
022cbd1616
commit
50a67f9301
8 changed files with 391 additions and 175 deletions
23
frontend/composables/use-locales/use-locales.ts
Normal file
23
frontend/composables/use-locales/use-locales.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { computed, useContext } from "@nuxtjs/composition-api";
|
||||
import { LOCALES } from "./available-locales";
|
||||
|
||||
export const useLocales = () => {
|
||||
const { i18n } = useContext();
|
||||
|
||||
const locale = computed<string>({
|
||||
get() {
|
||||
return i18n.locale;
|
||||
},
|
||||
set(value) {
|
||||
i18n.setLocale(value);
|
||||
// Reload the page to update the language - not all strings are reactive
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
locale,
|
||||
locales: LOCALES,
|
||||
i18n,
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue