weblate-luau 0.1.0

Generates a Luau table for weblate translations that are represented in basic JSON
/// A language mapped from codes.
pub struct Language {
    pub name: &'static str,
    pub fb_code: &'static str,
    pub additional_codes: &'static [&'static str],
}

impl Language {
    // Taken from https://store.steampowered.com/app/1238860/Battlefield_4/ and disassembled binary
    pub const ENGLISH: Self = Self::new("English", "en", &["en_US", "en_GB"]);
    pub const FRENCH: Self = Self::new("French", "fr", &["fr_FR", "fr_CA"]);
    pub const ITALIAN: Self = Self::new("Italian", "it", &["it_IT"]);
    pub const GERMAN: Self = Self::new("German", "de", &["de_DE"]);
    pub const SPANISH: Self = Self::new("Spanish - Spain", "es", &["es_ES"]);
    pub const CZECH: Self = Self::new("Czech", "cs", &["cs_CZ"]);
    pub const KOREAN: Self = Self::new("Korean", "ko", &["ko_KR"]);
    pub const POLISH: Self = Self::new("Polish", "pl", &["pl_PL"]);
    pub const PORTUGUESE: Self = Self::new("Portuguese - Brazil", "br", &["pt", "pt_BR", "pt_PT"]);
    pub const RUSSIAN: Self = Self::new("Russian", "ru", &["ru_RU"]);
    pub const CHINESE: Self = Self::new("Chinese - Traditional", "zh", &["zh_ZH", "zh_TW"]);
    pub const JAPANESE: Self = Self::new("Japanese", "ja", &["ja_JP"]);

    /// All supported frostbite languages.
    pub const FROSTBITE_LANGUAGES: &'static [Language] = &[
        Self::ENGLISH,
        Self::FRENCH,
        Self::ITALIAN,
        Self::GERMAN,
        Self::SPANISH,
        Self::CZECH,
        Self::KOREAN,
        Self::POLISH,
        Self::PORTUGUESE,
        Self::RUSSIAN,
        Self::CHINESE,
        Self::JAPANESE,
    ];

    const fn new(
        name: &'static str,
        fb_code: &'static str,
        additional_codes: &'static [&'static str],
    ) -> Self {
        Self {
            name,
            additional_codes,
            fb_code,
        }
    }
}