From 5bb08d8973b2ca1497d9abb347583aa1cedae7d0 Mon Sep 17 00:00:00 2001 From: CherryKitten Date: Mon, 28 Nov 2022 23:43:24 +0100 Subject: [PATCH] Don't hardcode locales --- locales/index.js | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/locales/index.js b/locales/index.js index 92cd9b467..3be17d471 100644 --- a/locales/index.js +++ b/locales/index.js @@ -13,33 +13,14 @@ const merge = (...args) => args.reduce((a, c) => ({ .reduce((a, [k, v]) => (a[k] = merge(v, c[k]), a), {}) }), {}); -const languages = [ - 'ar-SA', - 'cs-CZ', - 'da-DK', - 'de-DE', - 'en-US', - 'es-ES', - 'fr-FR', - 'id-ID', - 'it-IT', - 'ja-JP', - 'ja-KS', - 'kab-KAB', - 'kn-IN', - 'ko-KR', - 'nl-NL', - 'no-NO', - 'pl-PL', - 'pt-PT', - 'ru-RU', - 'sk-SK', - 'ug-CN', - 'uk-UA', - 'vi-VN', - 'zh-CN', - 'zh-TW', -]; +languages = [] + +fs.readdirSync(__dirname).forEach((file) => { + if (file.includes('.yml')){ + file = file.slice(0, file.indexOf('.')) + languages.push(file) + } +}) const primaries = { 'en': 'US',