From cac5f20a2806214581c1846cdb395dcf3d5f2d15 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Mon, 22 Mar 2021 21:49:06 +0000 Subject: [PATCH] Move locales definition to i18n.cr --- src/invidious.cr | 30 ------------------------------ src/invidious/helpers/i18n.cr | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 581e07828..ae20e13e5 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -65,36 +65,6 @@ SOFTWARE = { "branch" => "#{CURRENT_BRANCH}", } -LOCALES = { - "ar" => load_locale("ar"), - "de" => load_locale("de"), - "el" => load_locale("el"), - "en-US" => load_locale("en-US"), - "eo" => load_locale("eo"), - "es" => load_locale("es"), - "fa" => load_locale("fa"), - "fi" => load_locale("fi"), - "fr" => load_locale("fr"), - "he" => load_locale("he"), - "hr" => load_locale("hr"), - "id" => load_locale("id"), - "is" => load_locale("is"), - "it" => load_locale("it"), - "ja" => load_locale("ja"), - "nb-NO" => load_locale("nb-NO"), - "nl" => load_locale("nl"), - "pl" => load_locale("pl"), - "pt-BR" => load_locale("pt-BR"), - "pt-PT" => load_locale("pt-PT"), - "ro" => load_locale("ro"), - "ru" => load_locale("ru"), - "sv" => load_locale("sv-SE"), - "tr" => load_locale("tr"), - "uk" => load_locale("uk"), - "zh-CN" => load_locale("zh-CN"), - "zh-TW" => load_locale("zh-TW"), -} - YT_POOL = YoutubeConnectionPool.new(YT_URL, capacity: CONFIG.pool_size, timeout: 2.0, use_quic: CONFIG.use_quic) # CLI diff --git a/src/invidious/helpers/i18n.cr b/src/invidious/helpers/i18n.cr index 0faa2e329..45a3f1aea 100644 --- a/src/invidious/helpers/i18n.cr +++ b/src/invidious/helpers/i18n.cr @@ -1,3 +1,33 @@ +LOCALES = { + "ar" => load_locale("ar"), + "de" => load_locale("de"), + "el" => load_locale("el"), + "en-US" => load_locale("en-US"), + "eo" => load_locale("eo"), + "es" => load_locale("es"), + "fa" => load_locale("fa"), + "fi" => load_locale("fi"), + "fr" => load_locale("fr"), + "he" => load_locale("he"), + "hr" => load_locale("hr"), + "id" => load_locale("id"), + "is" => load_locale("is"), + "it" => load_locale("it"), + "ja" => load_locale("ja"), + "nb-NO" => load_locale("nb-NO"), + "nl" => load_locale("nl"), + "pl" => load_locale("pl"), + "pt-BR" => load_locale("pt-BR"), + "pt-PT" => load_locale("pt-PT"), + "ro" => load_locale("ro"), + "ru" => load_locale("ru"), + "sv" => load_locale("sv-SE"), + "tr" => load_locale("tr"), + "uk" => load_locale("uk"), + "zh-CN" => load_locale("zh-CN"), + "zh-TW" => load_locale("zh-TW"), +} + def load_locale(name) return JSON.parse(File.read("locales/#{name}.json")).as_h end