mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Add new translation key "Aspect Ratio"
This commit is contained in:
1 parent
a0f10141ab
commit
dbd799bce3
43 files changed
+90
-4
No files matched your search
@@ -18,6 +18,10 @@ enum Command {
|
||||
CopyMissingLines {},
|
||||
CommentUnknownLines {},
|
||||
RemoveUnknownLines {},
|
||||
AddNewKey {
|
||||
section: String,
|
||||
key: String,
|
||||
},
|
||||
MoveKey {
|
||||
old: String,
|
||||
new: String,
|
||||
@@ -89,6 +93,15 @@ fn remove_key(target_ini: &mut IniFile, section: &str, key: &str) -> io::Result<
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn add_new_key(target_ini: &mut IniFile, section: &str, key: &str) -> io::Result<()> {
|
||||
if let Some(section) = target_ini.get_section_mut(section) {
|
||||
let _ = section.insert_line_if_missing(&format!("{} = {}", key, key));
|
||||
} else {
|
||||
println!("No section {}", section);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let opt = Opt::from_args();
|
||||
|
||||
@@ -97,15 +110,15 @@ fn main() {
|
||||
let mut filenames = args;
|
||||
|
||||
let root = "../../assets/lang";
|
||||
let reference_file = "en_US.ini";
|
||||
let reference_ini_filename = "en_US.ini";
|
||||
|
||||
let reference_ini = IniFile::parse(&format!("{}/{}", root, reference_file)).unwrap();
|
||||
let mut reference_ini = IniFile::parse(&format!("{}/{}", root, reference_ini_filename)).unwrap();
|
||||
|
||||
if filenames.is_empty() {
|
||||
// Grab them all.
|
||||
for path in std::fs::read_dir(root).unwrap() {
|
||||
let path = path.unwrap();
|
||||
if path.file_name() == reference_file {
|
||||
if path.file_name() == reference_ini_filename {
|
||||
continue;
|
||||
}
|
||||
let filename = path.file_name();
|
||||
@@ -118,6 +131,7 @@ fn main() {
|
||||
}
|
||||
|
||||
for filename in filenames {
|
||||
let reference_ini = &reference_ini;
|
||||
if filename == "langtool" {
|
||||
// Get this from cargo run for some reason.
|
||||
continue;
|
||||
@@ -137,12 +151,16 @@ fn main() {
|
||||
Command::RemoveUnknownLines {} => {
|
||||
deal_with_unknown_lines(&reference_ini, &mut target_ini, true).unwrap();
|
||||
}
|
||||
Command::AddNewKey {
|
||||
ref section,
|
||||
ref key,
|
||||
} => add_new_key(&mut target_ini, section, key).unwrap(),
|
||||
Command::MoveKey {
|
||||
ref old,
|
||||
ref new,
|
||||
ref key,
|
||||
} => {
|
||||
move_key(&mut target_ini, &old, &new, &key).unwrap();
|
||||
move_key(&mut target_ini, old, new, key).unwrap();
|
||||
}
|
||||
Command::RemoveKey {
|
||||
ref section,
|
||||
@@ -155,5 +173,31 @@ fn main() {
|
||||
target_ini.write().unwrap();
|
||||
}
|
||||
|
||||
println!("Langtool processing {}", reference_ini_filename);
|
||||
|
||||
// Some commands also apply to the reference ini.
|
||||
match opt.cmd {
|
||||
Command::AddNewKey {
|
||||
ref section,
|
||||
ref key,
|
||||
} => {
|
||||
add_new_key(&mut reference_ini, section, key).unwrap();
|
||||
}
|
||||
Command::MoveKey {
|
||||
ref old,
|
||||
ref new,
|
||||
ref key,
|
||||
} => {
|
||||
move_key(&mut reference_ini, old, new, key).unwrap();
|
||||
}
|
||||
Command::RemoveKey {
|
||||
ref section,
|
||||
ref key,
|
||||
} => {
|
||||
remove_key(&mut reference_ini, section, key).unwrap();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// println!("{:#?}", target_ini);
|
||||
}
|
||||
Reference in new issue
Block a user