-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.rs
35 lines (31 loc) · 843 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use icu::locid::{langid, LanguageIdentifier};
use icu_datagen::{CldrLocaleSubset, Out, SourceData};
use std::{fs::File, path::Path};
fn new_database() {
let exists = Path::new("db.db").try_exists();
if !matches!(exists, Ok(true)) {
let _ = std::fs::copy("schema.db", "db.db");
}
}
const DISCORD_LOCALES: &[LanguageIdentifier] = &[langid!("en-GB"), langid!("en"), langid!("pl")];
fn icu_gen_list() {
icu_datagen::datagen(
Some(DISCORD_LOCALES),
&icu_datagen::keys(&[
"list/and@1",
"fallback/likelysubtags@1",
"fallback/parents@1",
]),
&SourceData::default()
.with_cldr_for_tag("41.0.0", CldrLocaleSubset::Modern)
.unwrap(),
vec![Out::Blob(Box::new(
File::create("i18n/data.postcard").unwrap(),
))],
)
.unwrap();
}
fn main() {
new_database();
icu_gen_list();
}