mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-21 14:03:32 -07:00
fix langauge assignment 1st pass
This commit is contained in:
parent
38b620a876
commit
1361ea41de
7 changed files with 48 additions and 56 deletions
11
dev/scripts/publish-release-branch.sh
Normal file
11
dev/scripts/publish-release-branch.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
git checkout dev
|
||||
git merge --strategy=ours master # keep the content of this branch, but record a merge
|
||||
git checkout master
|
||||
git merge dev # fast-forward master up to the merge
|
||||
|
||||
|
||||
## TODOs
|
||||
|
||||
# Create New Branch v0.x.x
|
||||
# Push Branch Version to Github
|
||||
# Create Pull Request
|
|
@ -1,5 +1,6 @@
|
|||
import { baseURL } from "./api-utils";
|
||||
import { apiReq } from "./api-utils";
|
||||
import { store } from "@/store";
|
||||
|
||||
const settingsBase = baseURL + "site-settings";
|
||||
|
||||
|
@ -11,7 +12,7 @@ const settingsURLs = {
|
|||
customPage: id => `${settingsBase}/custom-pages/${id}`,
|
||||
};
|
||||
|
||||
export const siteSettingsAPI = {
|
||||
export const siteSettingsAPI = {
|
||||
async get() {
|
||||
let response = await apiReq.get(settingsURLs.siteSettings);
|
||||
return response.data;
|
||||
|
@ -19,6 +20,7 @@ export const siteSettingsAPI = {
|
|||
|
||||
async update(body) {
|
||||
let response = await apiReq.put(settingsURLs.updateSiteSettings, body);
|
||||
store.dispatch("requestSiteSettings");
|
||||
return response.data;
|
||||
},
|
||||
|
||||
|
|
|
@ -117,21 +117,21 @@
|
|||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-text>
|
||||
<h2 class="mt-1 mb-4">{{$t('settings.locale-settings')}}</h2>
|
||||
<h2 class="mt-1 mb-4">{{ $t("settings.locale-settings") }}</h2>
|
||||
<v-row>
|
||||
<v-col cols="1">
|
||||
<LanguageMenu @select-lang="writeLang" :site-settings="true" />
|
||||
</v-col>
|
||||
<v-col sm="3">
|
||||
<v-select
|
||||
dense
|
||||
prepend-icon="mdi-calendar-week-begin"
|
||||
v-model="settings.firstDayOfWeek"
|
||||
:items="allDays"
|
||||
item-text="name"
|
||||
item-value="value"
|
||||
:label="$t('settings.first-day-of-week')"
|
||||
/>
|
||||
dense
|
||||
prepend-icon="mdi-calendar-week-begin"
|
||||
v-model="settings.firstDayOfWeek"
|
||||
:items="allDays"
|
||||
item-text="name"
|
||||
item-value="value"
|
||||
:label="$t('settings.first-day-of-week')"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
|
@ -178,33 +178,33 @@ export default {
|
|||
allDays() {
|
||||
return [
|
||||
{
|
||||
name: this.$t('general.sunday'),
|
||||
name: this.$t("general.sunday"),
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: this.$t('general.monday'),
|
||||
name: this.$t("general.monday"),
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: this.$t('general.tuesday'),
|
||||
name: this.$t("general.tuesday"),
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: this.$t('general.wednesday'),
|
||||
name: this.$t("general.wednesday"),
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: this.$t('general.thursday'),
|
||||
name: this.$t("general.thursday"),
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
name: this.$t('general.friday'),
|
||||
name: this.$t("general.friday"),
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: this.$t('general.saturday'),
|
||||
name: this.$t("general.saturday"),
|
||||
value: 6,
|
||||
}
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
|
@ -223,10 +223,8 @@ export default {
|
|||
this.settings.categories.splice(index, 1);
|
||||
},
|
||||
async saveSettings() {
|
||||
await api.siteSettings.update(this.settings);
|
||||
this.$store.dispatch("setLang", {
|
||||
currentVueComponent: this,
|
||||
language: this.settings.language });
|
||||
const newSettings = await api.siteSettings.update(this.settings);
|
||||
console.log("New Settings", newSettings);
|
||||
this.getOptions();
|
||||
},
|
||||
},
|
||||
|
|
|
@ -69,13 +69,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
setLanguage(selectedLanguage) {
|
||||
if (this.siteSettings) {
|
||||
this.$emit(SELECT_EVENT, selectedLanguage);
|
||||
} else {
|
||||
this.$store.dispatch("setLang", {
|
||||
currentVueComponent: this,
|
||||
language: selectedLanguage });
|
||||
}
|
||||
this.$emit(SELECT_EVENT, selectedLanguage);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import VueI18n from "../../i18n";
|
||||
|
||||
const state = {
|
||||
lang: "en-US",
|
||||
allLangs: [
|
||||
|
@ -42,33 +40,11 @@ const state = {
|
|||
],
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
setLang(state, payload) {
|
||||
VueI18n.locale = payload;
|
||||
state.lang = payload;
|
||||
},
|
||||
};
|
||||
|
||||
const actions = {
|
||||
initLang({ getters }, { currentVueComponent }) {
|
||||
VueI18n.locale = getters.getActiveLang;
|
||||
currentVueComponent.$vuetify.lang.current = getters.getActiveLang;
|
||||
},
|
||||
setLang({ commit }, { language, currentVueComponent }) {
|
||||
VueI18n.locale = language;
|
||||
currentVueComponent.$vuetify.lang.current = language;
|
||||
commit('setLang', language);
|
||||
},
|
||||
};
|
||||
|
||||
const getters = {
|
||||
getActiveLang: state => state.lang,
|
||||
getAllLangs: state => state.allLangs,
|
||||
};
|
||||
|
||||
export default {
|
||||
state,
|
||||
mutations,
|
||||
actions,
|
||||
getters,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import { api } from "@/api";
|
||||
import VueI18n from "@/i18n";
|
||||
import Vuetify from "@/plugins/vuetify";
|
||||
|
||||
const state = {
|
||||
siteSettings: {
|
||||
|
@ -13,17 +15,26 @@ const state = {
|
|||
const mutations = {
|
||||
setSettings(state, payload) {
|
||||
state.siteSettings = payload;
|
||||
VueI18n.locale = payload.language;
|
||||
Vuetify.framework.lang.current = payload.language;
|
||||
},
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async requestSiteSettings() {
|
||||
async requestSiteSettings({ commit }) {
|
||||
let settings = await api.siteSettings.get();
|
||||
this.commit("setSettings", settings);
|
||||
commit("setSettings", settings);
|
||||
},
|
||||
async initLang({ getters, commit }) {
|
||||
// !Can Porbably Remove This?
|
||||
await actions.requestSiteSettings({ commit });
|
||||
VueI18n.locale = getters.getActiveLang;
|
||||
Vuetify.framework.lang.current = getters.getActiveLang;
|
||||
},
|
||||
};
|
||||
|
||||
const getters = {
|
||||
getActiveLang: state => state.siteSettings.language,
|
||||
getSiteSettings: state => state.siteSettings,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { api } from "@/api";
|
||||
import Vuetify from "../../plugins/vuetify";
|
||||
import Vuetify from "@/plugins/vuetify";
|
||||
import axios from "axios";
|
||||
|
||||
function inDarkMode(payload) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue