From 8b3cb234d54349d0e7a37ea28431d8d3b7e66c6c Mon Sep 17 00:00:00 2001 From: Bilguun Ochirbat Date: Mon, 14 Sep 2020 18:31:15 +0800 Subject: [PATCH 1/4] Added Mongolian language --- lang/mn-MN.json | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/lang.js | 6 +++- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 lang/mn-MN.json diff --git a/lang/mn-MN.json b/lang/mn-MN.json new file mode 100644 index 00000000..2b4d7743 --- /dev/null +++ b/lang/mn-MN.json @@ -0,0 +1,85 @@ +{ + "active-users.message": "одоо {x} {x, plural, one {зочин} other {зочин}} байна", + "button.add-account": "Хэрэглэгч нэмэх", + "button.add-website": "Веб нэмэх", + "button.back": "Буцах", + "button.cancel": "Цуцлах", + "button.change-password": "Нууц үг солих", + "button.copy-to-clipboard": "Хуулах", + "button.delete": "Устгах", + "button.edit": "Засах", + "button.login": "Нэвтрэх", + "button.more": "Цааш", + "button.save": "Хадгалах", + "button.view-details": "Дэлгэрүүлж харах", + "button.websites": "Вебүүд", + "footer.powered-by": "Powered by", + "header.nav.dashboard": "Хянах самбар", + "header.nav.settings": "Тохиргоо", + "label.administrator": "Админ", + "label.confirm-password": "Шинэ нууц үгээ давтах", + "label.current-password": "Ашиглаж буй нууц үг", + "label.custom-range": "Дурын хугацаа", + "label.domain": "Домэйн", + "label.enable-share-url": "Хуваалцах холбоос идэвхжүүлэх", + "label.invalid": "Буруу", + "label.invalid-domain": "Буруу домэйн", + "label.last-days": "Сүүлийн {x} өдөр", + "label.last-hours": "Сүүлийн {x} цаг", + "label.logged-in-as": "{username}-р нэвтэрсэн", + "label.logout": "Гарах", + "label.name": "Нэр", + "label.new-password": "Шинэ нууц үг", + "label.password": "Нууц үг", + "label.passwords-dont-match": "Нууц үг тохирохгүй байна", + "label.required": "Шаардлагатай", + "label.this-month": "Энэ сар", + "label.this-week": "Энэ долоо хоног", + "label.this-year": "Энэ жил", + "label.today": "Өнөөдөр", + "label.username": "Хэрэглэгчийн нэр", + "message.confirm-delete": "Та {target}-г устгахдаа итгэлтэй байна уу?", + "message.copied": "Хуулсан!", + "message.delete-warning": "Үүнтэй холбоотой бүх өгөгдөл устах болно.", + "message.failure": "Ямар нэг зүйл буруу боллоо.", + "message.incorrect-username-password": "Буруу хэрэглэгчийн нэр/нууц үг.", + "message.no-data-available": "Өгөгдөл алга.", + "message.page-not-found": "Хуудас олдсонгүй.", + "message.save-success": "Амжилттай хадгаллаа.", + "message.share-url": "{target}-г нийтэд хуваалцах холбоос.", + "message.track-stats": "{target} вебийн статистикийг бүртгэхийн тулд доорх кодыг вебийнхээ {head} хэсэгт байрлуулна уу.", + "message.type-delete": "Доорх хэсэгт {delete} гэж бичиж баталгаажуулна уу.", + "metrics.actions": "Үйлдлүүд", + "metrics.average-visit-time": "Зочилсон дундаж хугацаа", + "metrics.bounce-rate": "Нэг хуудас үзээд гарсан", + "metrics.browsers": "Хөтөч", + "metrics.countries": "Улс", + "metrics.devices": "Төхөөрөмж", + "metrics.events": "Үйлдэл", + "metrics.filter.combined": "Нэгтгэсэн", + "metrics.filter.domain-only": "Зөвхөн домэйн", + "metrics.filter.raw": "Түүхий", + "metrics.operating-systems": "Үйлдлийн систем", + "metrics.page-views": "Хуудас үзсэн", + "metrics.pages": "Хуудас", + "metrics.referrers": "Чиглүүлэгч", + "metrics.unique-visitors": "Зочид", + "metrics.views": "Үзсэн", + "metrics.visitors": "Зочид", + "placeholder.message.go-to-settings": "Тохиргоо руу очих", + "placeholder.message.no-websites-configured": "Та ямар нэгэн веб тохируулаагүй байна.", + "settings.accounts": "Хэрэглэгчид", + "settings.profile": "Бүртгэл", + "settings.websites": "Вебүүд", + "title.add-account": "Хэрэглэгч нэмэх", + "title.add-website": "Веб нэмэх", + "title.change-password": "Нууц үг солих", + "title.delete-account": "Хэрэглэгч устгах", + "title.delete-website": "Веб устгах", + "title.edit-account": "Хэрэглэгч засах", + "title.edit-website": "Веб засах", + "title.share-url": "Хуваалцах холбоос", + "title.tracking-code": "Мөрдөх код", + "tooltip.get-share-url": "Хуваалцах холбоос авах", + "tooltip.get-tracking-code": "Мөрдөх код авах" +} diff --git a/lib/lang.js b/lib/lang.js index 3f097a2e..b23d6585 100644 --- a/lib/lang.js +++ b/lib/lang.js @@ -1,5 +1,5 @@ import { format } from 'date-fns'; -import { enUS, nl, zhCN, tr, ru, de, ja, es } from 'date-fns/locale'; +import { enUS, nl, zhCN, tr, ru, de, ja, es, mn } from 'date-fns/locale'; import enMessages from 'lang-compiled/en-US.json'; import nlMessages from 'lang-compiled/nl-NL.json'; import zhCNMessages from 'lang-compiled/zh-CN.json'; @@ -8,6 +8,7 @@ import ruRUMessages from 'lang-compiled/ru-RU.json'; import deDEMessages from 'lang-compiled/de-DE.json'; import jaMessages from 'lang-compiled/ja-JP.json'; import esMXMessages from 'lang-compiled/es-MX.json'; +import mnMNMessages from 'lang-compiled/mn-MN.json'; export const messages = { 'en-US': enMessages, @@ -18,6 +19,7 @@ export const messages = { 'tr-TR': trTRMessages, 'ja-JP': jaMessages, 'es-MX': esMXMessages, + 'mn-MN': mnMNMessages, }; export const dateLocales = { @@ -29,6 +31,7 @@ export const dateLocales = { 'tr-TR': tr, 'ja-JP': ja, 'es-MX': es, + 'mn-MN': enUS, }; export const menuOptions = [ @@ -37,6 +40,7 @@ export const menuOptions = [ { label: 'Deutsch', value: 'de-DE', display: 'DE' }, { label: 'Español', value: 'es-MX', display: 'ES' }, { label: '日本語', value: 'ja-JP', display: 'JP' }, + { label: 'Монгол', value: 'mn-MN', display: 'MN' }, { label: 'Nederlands', value: 'nl-NL', display: 'NL' }, { label: 'Русский', value: 'ru-RU', display: 'RU' }, { label: 'Turkish', value: 'tr-TR', display: 'TR' }, From ea9f921c81f54aab1e0df8ac39966061c2fbdf96 Mon Sep 17 00:00:00 2001 From: Bilguun Ochirbat Date: Mon, 14 Sep 2020 18:34:08 +0800 Subject: [PATCH 2/4] removed unnecessary import --- lib/lang.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lang.js b/lib/lang.js index b23d6585..5132362a 100644 --- a/lib/lang.js +++ b/lib/lang.js @@ -1,5 +1,5 @@ import { format } from 'date-fns'; -import { enUS, nl, zhCN, tr, ru, de, ja, es, mn } from 'date-fns/locale'; +import { enUS, nl, zhCN, tr, ru, de, ja, es } from 'date-fns/locale'; import enMessages from 'lang-compiled/en-US.json'; import nlMessages from 'lang-compiled/nl-NL.json'; import zhCNMessages from 'lang-compiled/zh-CN.json'; From 4478dfe5aec1e0b9b78ce79027f76dea4f9aedab Mon Sep 17 00:00:00 2001 From: CamTosh Date: Mon, 14 Sep 2020 18:56:22 +0200 Subject: [PATCH 3/4] Add FR lang --- lang/fr-FR.json | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/lang.js | 6 +++- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 lang/fr-FR.json diff --git a/lang/fr-FR.json b/lang/fr-FR.json new file mode 100644 index 00000000..f333ade5 --- /dev/null +++ b/lang/fr-FR.json @@ -0,0 +1,85 @@ +{ + "active-users.message": "{x} {x, plural, one {visiteur} other {visiteurs}} actuellement", + "button.add-account": "Ajouter un compte", + "button.add-website": "Ajouter un site", + "button.back": "Retour", + "button.cancel": "Annuler", + "button.change-password": "Changer de mot de passse", + "button.copy-to-clipboard": "Copier dans le presse papier", + "button.delete": "Supprimer", + "button.edit": "Modifier", + "button.login": "Connexion", + "button.more": "Plus", + "button.save": "Sauvegarder", + "button.view-details": "Voir les details", + "button.websites": "Sites", + "footer.powered-by": "Propulsé par", + "header.nav.dashboard": "Tableau de bord", + "header.nav.settings": "Paramètres", + "label.administrator": "Administrateur", + "label.confirm-password": "Confirmation du mot de passe", + "label.current-password": "Mot de passe actuel", + "label.custom-range": "Plage personnalisée", + "label.domain": "Domaine", + "label.enable-share-url": "Activer le partage d'URL", + "label.invalid": "Invalide", + "label.invalid-domain": "Domaine invalide", + "label.last-days": "{x} derniers jours", + "label.last-hours": "{x} dernières heures", + "label.logged-in-as": "Connecté en tant que {username}", + "label.logout": "Déconnexion", + "label.name": "Nom", + "label.new-password": "Nouveau mot de passe", + "label.password": "Mot de passe", + "label.passwords-dont-match": "Les mots de passe ne correspondent pas", + "label.required": "Requis", + "label.this-month": "Ce mois ci", + "label.this-week": "Cette semaine", + "label.this-year": "Cette année", + "label.today": "Aujourd'hui", + "label.username": "Nom d'utilisateur", + "message.confirm-delete": "Êtes-vous sur de vouloir supprimer {target}?", + "message.copied": "Copié !", + "message.delete-warning": "Toutes les données associées seront également supprimées.", + "message.failure": "Un problème est survenu.", + "message.incorrect-username-password": "nom d'utilisateurs/mot de passe incorrect.", + "message.no-data-available": "Pas de données disponibles.", + "message.page-not-found": "Page non trouvée.", + "message.save-success": "Enregistré avec succès.", + "message.share-url": "Ceci est l'URL partagée pour {target}.", + "message.track-stats": "Pour suivre les statistiques de {target}, placez le code suivant dans la section {head} de votre site Web.", + "message.type-delete": "Tapez {delete} dans la case ci-dessous pour confirmer.", + "metrics.actions": "Actions", + "metrics.average-visit-time": "Temps de visite moyen", + "metrics.bounce-rate": "Taux de rebond", + "metrics.browsers": "Navigateurs", + "metrics.countries": "Pays", + "metrics.devices": "Appareils", + "metrics.events": "Événements", + "metrics.filter.combined": "Combiné", + "metrics.filter.domain-only": "Domaine uniquement", + "metrics.filter.raw": "Brute", + "metrics.operating-systems": "Systèmes d'exploitation", + "metrics.page-views": "Pages vues", + "metrics.pages": "Pages", + "metrics.referrers": "URL Référentes", + "metrics.unique-visitors": "Visiteurs uniques", + "metrics.views": "Vues", + "metrics.visitors": "Visiteurs", + "placeholder.message.go-to-settings": "Aller aux paramètres", + "placeholder.message.no-websites-configured": "Vous n'avez configuré aucun site Web.", + "settings.accounts": "Comptes", + "settings.profile": "Profile", + "settings.websites": "Sites", + "title.add-account": "Ajouter un compte", + "title.add-website": "Ajouter un site", + "title.change-password": "Changer le mot de passe", + "title.delete-account": "Supprimer le compte", + "title.delete-website": "Suprimer le site", + "title.edit-account": "Modifier le compte", + "title.edit-website": "Modifier le site", + "title.share-url": "Partager l'URL", + "title.tracking-code": "Code de suivi", + "tooltip.get-share-url": "Obtenez l'URL de partage", + "tooltip.get-tracking-code": "Obtenez le code de suivi" +} diff --git a/lib/lang.js b/lib/lang.js index 5132362a..d45d7ce0 100644 --- a/lib/lang.js +++ b/lib/lang.js @@ -1,5 +1,5 @@ import { format } from 'date-fns'; -import { enUS, nl, zhCN, tr, ru, de, ja, es } from 'date-fns/locale'; +import { enUS, nl, zhCN, tr, ru, de, ja, es, fr } from 'date-fns/locale'; import enMessages from 'lang-compiled/en-US.json'; import nlMessages from 'lang-compiled/nl-NL.json'; import zhCNMessages from 'lang-compiled/zh-CN.json'; @@ -8,6 +8,7 @@ import ruRUMessages from 'lang-compiled/ru-RU.json'; import deDEMessages from 'lang-compiled/de-DE.json'; import jaMessages from 'lang-compiled/ja-JP.json'; import esMXMessages from 'lang-compiled/es-MX.json'; +import frMessages from 'lang-compiled/fr-FR.json'; import mnMNMessages from 'lang-compiled/mn-MN.json'; export const messages = { @@ -19,6 +20,7 @@ export const messages = { 'tr-TR': trTRMessages, 'ja-JP': jaMessages, 'es-MX': esMXMessages, + 'fr-FR': frMessages, 'mn-MN': mnMNMessages, }; @@ -31,6 +33,7 @@ export const dateLocales = { 'tr-TR': tr, 'ja-JP': ja, 'es-MX': es, + 'fr-FR': fr, 'mn-MN': enUS, }; @@ -39,6 +42,7 @@ export const menuOptions = [ { label: '中文', value: 'zh-CN', display: 'CN' }, { label: 'Deutsch', value: 'de-DE', display: 'DE' }, { label: 'Español', value: 'es-MX', display: 'ES' }, + { label: 'Français', value: 'fr-FR', display: 'FR' }, { label: '日本語', value: 'ja-JP', display: 'JP' }, { label: 'Монгол', value: 'mn-MN', display: 'MN' }, { label: 'Nederlands', value: 'nl-NL', display: 'NL' }, From bde1949e8feac2bef44787a7bab648e3d98e8684 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 15 Sep 2020 08:50:05 -0700 Subject: [PATCH 4/4] Fix password change issue. --- package.json | 2 +- pages/api/account/password.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e6dc21ec..18207e6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "umami", - "version": "0.33.0", + "version": "0.34.0", "description": "A simple, fast, website analytics alternative to Google Analytics. ", "author": "Mike Cao ", "license": "MIT", diff --git a/pages/api/account/password.js b/pages/api/account/password.js index c9c955fa..1b364d7b 100644 --- a/pages/api/account/password.js +++ b/pages/api/account/password.js @@ -6,10 +6,10 @@ import { checkPassword, hashPassword } from 'lib/crypto'; export default async (req, res) => { await useAuth(req, res); - const { user_id, is_admin } = req.auth; - const { current_password, new_password } = req.body; + const { user_id: auth_user_id, is_admin } = req.auth; + const { user_id, current_password, new_password } = req.body; - if (is_admin) { + if (!is_admin || user_id !== auth_user_id) { return unauthorized(res); }