Portuguese (Brazil), Uzbek (Latin) and Kazakh (Cyrillic) on the desktop, Android and the site

Nine interface languages. The system's language is picked up; Portuguese notation has its
own piece letters (R D T B C), Uzbek and Kazakh keep the Latin ones (the 'letters of
the language' choice is not offered for them). Uzbek o'/g' are written with U+2018 on
the desktop, whose font has no U+02BB. Comment translation targets the new languages too.
The shelf's two side cards widen for a longer label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-24 12:48:03 +03:00
parent 0594e819d2
commit 9734108b83
29 changed files with 4647 additions and 105 deletions

View file

@ -18,6 +18,9 @@ pub const LANGS: &[(&str, &str, &str)] = &[
("de", "Deutsch", "de_DE"),
("es", "Español", "es_ES"),
("it", "Italiano", "it_IT"),
("pt", "Português", "pt_BR"),
("uz", "Oʻzbekcha", "uz_UZ"),
("kk", "Қазақша", "kk_KZ"),
];
/// Screenshots in gallery order (file stem); the first one is shown in the hero.
@ -335,7 +338,7 @@ impl Site {
/// On `/` only, before anything is drawn: the language chosen before, else the first
/// browser language the site has, else English stays.
const ROOT_REDIRECT: &str = r#"<script>(function(){var L=["ru","fr","de","es","it"],p=null;try{p=localStorage.getItem("lang")}catch(e){}if(!p){var ls=navigator.languages||[navigator.language||""];for(var i=0;i<ls.length;i++){var c=(ls[i]||"").slice(0,2).toLowerCase();if(c==="en"||L.indexOf(c)>=0){p=c;break}}}if(p&&p!=="en"&&L.indexOf(p)>=0){location.replace("/"+p+"/"+location.hash)}})();</script>"#;
const ROOT_REDIRECT: &str = r#"<script>(function(){var L=["ru","fr","de","es","it","pt","uz","kk"],p=null;try{p=localStorage.getItem("lang")}catch(e){}if(!p){var ls=navigator.languages||[navigator.language||""];for(var i=0;i<ls.length;i++){var c=(ls[i]||"").slice(0,2).toLowerCase();if(c==="en"||L.indexOf(c)>=0){p=c;break}}}if(p&&p!=="en"&&L.indexOf(p)>=0){location.replace("/"+p+"/"+location.hash)}})();</script>"#;
fn attr(s: &str) -> String {
s.replace('&', "&amp;").replace('"', "&quot;").replace('<', "&lt;")
@ -368,13 +371,18 @@ fn date(rfc3339: &str, lang: &str) -> String {
"de" => ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
"es" => ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"],
"it" => ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"],
"pt" => ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"],
"uz" => ["yanvar", "fevral", "mart", "aprel", "may", "iyun", "iyul", "avgust", "sentabr", "oktabr", "noyabr", "dekabr"],
"kk" => ["қаңтар", "ақпан", "наурыз", "сәуір", "мамыр", "маусым", "шілде", "тамыз", "қыркүйек", "қазан", "қараша", "желтоқсан"],
_ => ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
};
let month = months[m - 1];
match lang {
"en" => format!("{month} {d}, {y}"),
"de" => format!("{d}. {month} {y}"),
"es" => format!("{d} de {month} de {y}"),
"es" | "pt" => format!("{d} de {month} de {y}"),
"uz" => format!("{y}-yil {d}-{month}"),
"kk" => format!("{y} жылғы {d} {month}"),
_ => format!("{d} {month} {y}"),
}
}
@ -391,6 +399,9 @@ mod tests {
assert_eq!(date("2026-10-19T06:54:58Z", "ru"), "19 октября 2026");
assert_eq!(date("2026-10-19T06:54:58Z", "de"), "19. Oktober 2026");
assert_eq!(date("2026-10-19T06:54:58Z", "es"), "19 de octubre de 2026");
assert_eq!(date("2026-10-19T06:54:58Z", "pt"), "19 de outubro de 2026");
assert_eq!(date("2026-10-19T06:54:58Z", "uz"), "2026-yil 19-oktabr");
assert_eq!(date("2026-10-19T06:54:58Z", "kk"), "2026 жылғы 19 қазан");
assert_eq!(date("bad", "en"), "");
}