# FrugalityBot # Copyright (C) 2026 Eri (csxkdv/nxkdv) nxkdv@thenight.club # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . require 'i18n' module LocalesHelper def self.generate(key_path) locales_map = {} discord_map = { :en => 'en-US', :es => 'es-ES' } I18n.available_locales.each do |lang| next if lang == :en text = I18n.t(key_path, locale: lang, default: nil) if text && text != 'nil' discord_code = discord_map[lang] || lang.to_s locales_map[discord_code] = text end end return locales_map end end