langtool: When renaming the key of untranslated strings, also change the value.
This commit is contained in:
parent
737ec3e90b
commit
75a59d100a
2 changed files with 12 additions and 2 deletions
|
@ -242,7 +242,12 @@ fn main() {
|
|||
ref section,
|
||||
ref old,
|
||||
ref new,
|
||||
} => rename_key(&mut reference_ini, section, old, new).unwrap(),
|
||||
} => {
|
||||
if old == new {
|
||||
println!("WARNING: old == new");
|
||||
}
|
||||
rename_key(&mut reference_ini, section, old, new).unwrap();
|
||||
}
|
||||
Command::MoveKey {
|
||||
ref old,
|
||||
ref new,
|
||||
|
|
|
@ -92,7 +92,12 @@ impl Section {
|
|||
}
|
||||
if let Some(index) = found_index {
|
||||
let line = self.lines.remove(index);
|
||||
let line = new.to_owned() + " =" + line.strip_prefix(&prefix).unwrap();
|
||||
let mut right_part = line.strip_prefix(&prefix).unwrap().to_string();
|
||||
if right_part.trim() == old.trim() {
|
||||
// Was still untranslated - replace the translation too.
|
||||
right_part = format!(" {}", new);
|
||||
}
|
||||
let line = new.to_owned() + " =" + &right_part;
|
||||
self.insert_line_if_missing(&line);
|
||||
} else {
|
||||
let name = &self.name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue