Use country code as default language
gitea/salix/master This commit looks good Details
gitea/salix/test This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-12-19 12:42:50 +01:00
parent 9947021736
commit 7fa22da619
1 changed files with 5 additions and 2 deletions

View File

@ -13,8 +13,11 @@ const userLocale = {
methods: {
getLocale(clientId) {
return db.findOne(`
SELECT lang FROM account.user
WHERE id = ?`, [clientId]).then(rows => {
SELECT IF(u.lang IS NOT NULL, u.lang, LOWER(ct.code)) lang
FROM client c
JOIN country ct ON ct.id = c.countryFk
JOIN account.user u ON u.id = c.id
WHERE c.id = ?`, [clientId]).then(rows => {
if (rows)
return rows.lang;
else return fallbackLocale;