Keep the files many PRs add to conflict-free (#1564)
Message catalogs sorted one message per line (cargo xtask lists [--fix], checked in cargo xtask ci and the Lists workflow); the language list one per line, English first then by id; THIRD-PARTY-LICENSES.txt and docs/features.md rewritten on main by the Generated files workflow instead of in PRs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
342305705d
commit
f08ed74617
18 files changed
+6001
-5817
No files matched your search
@@ -32,15 +32,28 @@ impl Catalog {
|
||||
}
|
||||
|
||||
static ENGLISH: Catalog = Catalog::new("en", "English", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/en.json")));
|
||||
static JAPANESE: Catalog = Catalog::new("ja", "日本語", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ja.json")));
|
||||
static GERMAN: Catalog = Catalog::new("de", "Deutsch", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/de.json")));
|
||||
static FRENCH: Catalog = Catalog::new("fr", "Français", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/fr.json")));
|
||||
static JAPANESE: Catalog = Catalog::new("ja", "日本語", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ja.json")));
|
||||
static KOREAN: Catalog = Catalog::new("ko", "한국어", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ko.json")));
|
||||
static RUSSIAN: Catalog = Catalog::new("ru", "Русский", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ru.json")));
|
||||
static UKRAINIAN: Catalog = Catalog::new("uk", "Українська", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/uk.json")));
|
||||
static TURKISH: Catalog = Catalog::new("tr", "Türkçe", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/tr.json")));
|
||||
static UKRAINIAN: Catalog = Catalog::new("uk", "Українська", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/uk.json")));
|
||||
static CHINESE: Catalog = Catalog::new("zh", "中文", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/zh.json")));
|
||||
pub const LOCALES: &[&Catalog] = &[&ENGLISH, &JAPANESE, &GERMAN, &FRENCH, &KOREAN, &RUSSIAN, &UKRAINIAN, &TURKISH, &CHINESE];
|
||||
/// English first (the fallback), then by language id, one per line so that adding a language
|
||||
/// doesn't edit a line another addition edits.
|
||||
#[rustfmt::skip]
|
||||
pub const LOCALES: &[&Catalog] = &[
|
||||
&ENGLISH,
|
||||
&GERMAN,
|
||||
&FRENCH,
|
||||
&JAPANESE,
|
||||
&KOREAN,
|
||||
&RUSSIAN,
|
||||
&TURKISH,
|
||||
&UKRAINIAN,
|
||||
&CHINESE,
|
||||
];
|
||||
|
||||
pub fn is_supported(id: &str) -> bool {
|
||||
LOCALES.iter().any(|catalog| catalog.id == id)
|
||||
@@ -188,6 +201,15 @@ pub fn tr_name(text: &str) -> String {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// The languages are listed English first, then by id, so adding one doesn't edit the
|
||||
/// line another addition edits.
|
||||
#[test]
|
||||
fn locales_are_listed_english_first_then_by_id() {
|
||||
let ids: Vec<&str> = LOCALES.iter().map(|c| c.id).collect();
|
||||
assert_eq!(ids.first(), Some(&"en"));
|
||||
assert!(ids[1..].is_sorted(), "{ids:?}");
|
||||
}
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
fn placeholders(text: &str) -> BTreeSet<&str> {
|
||||
|
||||
Reference in new issue
Block a user