UPDATE: Dump of initial files

This commit is contained in:
Nicolás Hatcher
2023-11-18 21:26:18 +01:00
commit c5b8efd83d
279 changed files with 42654 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
{
"en": {
"booleans": {
"true": "TRUE",
"false": "FALSE"
},
"errors":{
"ref": "#REF!",
"name": "#NAME?",
"value": "#VALUE!",
"div": "#DIV/0!",
"na": "#N/A",
"num": "#NUM!",
"error": "#ERROR!",
"nimpl": "#N/IMPL!",
"spill": "#SPILL!",
"null": "#NULL!",
"calc": "#CALC!",
"circ": "#CIRC!"
}
},
"de": {
"booleans": {
"true": "WAHR",
"false": "FALSCH"
},
"errors":{
"ref": "#BEZUG!",
"name": "#NAME?",
"value": "#WERT!",
"div": "#DIV/0!",
"na": "#NV",
"num": "#ZAHL!",
"error": "#ERROR!",
"nimpl": "#N/IMPL!",
"spill": "#ÜBERLAUF!",
"null": "#NULL!",
"calc": "#CALC!",
"circ": "#CIRC!"
}
},
"fr": {
"booleans": {
"true": "VRAI",
"false": "FAUX"
},
"errors":{
"ref": "#REF!",
"name": "#NOM?",
"value": "#VALEUR!",
"div": "#DIV/0!",
"na": "#N/A",
"num": "#NOMBRE!",
"error": "#ERROR!",
"nimpl": "#N/IMPL!",
"spill": "#SPILL!",
"null": "#NULL!",
"calc": "#CALC!",
"circ": "#CIRC!"
}
},
"es": {
"booleans": {
"true": "VERDADERO",
"false": "FALSO"
},
"errors": {
"ref": "#¡REF!",
"name": "#¿NOMBRE?",
"value": "#¡VALOR!",
"div": "#¡DIV/0!",
"na": "#N/A",
"num": "#¡NUM!",
"error": "#ERROR!",
"nimpl": "#N/IMPL!",
"spill": "#SPILL!",
"null": "#NULL!",
"calc": "#CALC!",
"circ": "#CIRC!"
}
}
}

46
base/src/language/mod.rs Normal file
View File

@@ -0,0 +1,46 @@
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Clone)]
pub struct Booleans {
#[serde(rename = "true")]
pub true_value: String,
#[serde(rename = "false")]
pub false_value: String,
}
#[derive(Serialize, Deserialize, Clone)]
pub struct Errors {
#[serde(rename = "ref")]
pub ref_value: String,
pub name: String,
pub value: String,
pub div: String,
pub na: String,
pub num: String,
pub nimpl: String,
pub spill: String,
pub calc: String,
pub circ: String,
pub error: String,
pub null: String,
}
#[derive(Serialize, Deserialize, Clone)]
pub struct Language {
pub booleans: Booleans,
pub errors: Errors,
}
static LANGUAGES: Lazy<HashMap<String, Language>> = Lazy::new(|| {
serde_json::from_str(include_str!("language.json")).expect("Failed parsing language file")
});
pub fn get_language(id: &str) -> Result<&Language, String> {
let language = LANGUAGES
.get(id)
.ok_or(format!("Language is not supported: '{}'", id))?;
Ok(language)
}