add translators.json
This commit is contained in:
parent
f24e57a452
commit
0d478c4477
8
data/config/translators.json
Normal file
8
data/config/translators.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"translators": [
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"translator": "English (United States):\nCosmo"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -68,14 +68,25 @@ pub fn welcome_content_page(window: &adw::ApplicationWindow, content_box: >k::
|
|||||||
.icon_name("dialog-information-symbolic")
|
.icon_name("dialog-information-symbolic")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mut json_array: Vec<GString> = Vec::new();
|
let mut dev_json_array: Vec<GString> = Vec::new();
|
||||||
let json_path = "/usr/share/pika-welcome/config/credits.json";
|
let dev_json_path = "/usr/share/pika-welcome/config/credits.json";
|
||||||
let json_data = std::fs::read_to_string(json_path).expect("Unable to read json");
|
let dev_json_data = std::fs::read_to_string(dev_json_path).expect("Unable to read json");
|
||||||
let json_data: serde_json::Value =
|
let dev_json_data: serde_json::Value =
|
||||||
serde_json::from_str(&json_data).expect("JSON format invalid");
|
serde_json::from_str(&dev_json_data).expect("JSON format invalid");
|
||||||
if let serde_json::Value::Array(developers) = &json_data["developers"] {
|
if let serde_json::Value::Array(developers) = &dev_json_data["developers"] {
|
||||||
for developer in developers {
|
for developer in developers {
|
||||||
json_array.push(developer["dev"].as_str().to_owned().unwrap().into())
|
dev_json_array.push(developer["dev"].as_str().to_owned().unwrap().into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut translator_json_array: Vec<GString> = Vec::new();
|
||||||
|
let translator_json_path = "/usr/share/pika-welcome/config/translators.json";
|
||||||
|
let translator_json_data = std::fs::read_to_string(dev_json_path).expect("Unable to read json");
|
||||||
|
let translator_json_data: serde_json::Value =
|
||||||
|
serde_json::from_str(&translator_json_data).expect("JSON format invalid");
|
||||||
|
if let serde_json::Value::Array(translators) = &dev_json_data["translators"] {
|
||||||
|
for translator in translators {
|
||||||
|
translator_json_array.push(translator["translator"].as_str().to_owned().unwrap().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +97,8 @@ pub fn welcome_content_page(window: &adw::ApplicationWindow, content_box: >k::
|
|||||||
.version(VERSION)
|
.version(VERSION)
|
||||||
.hide_on_close(true)
|
.hide_on_close(true)
|
||||||
.developer_name(t!("app_dev"))
|
.developer_name(t!("app_dev"))
|
||||||
.developers(json_array)
|
.developers(dev_json_array)
|
||||||
|
.translator_credits(translator_json_array)
|
||||||
.issue_url(APP_GITHUB.to_owned() + "/issues")
|
.issue_url(APP_GITHUB.to_owned() + "/issues")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user