public Apply ( List |
||
entries | List |
|
resdir | ||
statusOutput | ||
return | void |
public void Apply(List<PoEntry> entries, ResourceDirectory resdir, TextWriter statusOutput)
{
foreach (PoEntry entry in entries) {
foreach (PoLocation location in entry.Locations) {
LocString str = FindLocString(location, resdir);
if (str != null) {
ApplyEntry(entry, str, statusOutput);
}
else {
statusOutput.WriteLine("No string found for non-loc '{0}' in '{1}'/'{2}' ", entry.NonLocalized, location.FileName, location.Name);
}
}
foreach (ResXFile resxfile in resdir.AllFiles)
foreach (LocString str in resxfile.AllStrings) {
if (str.NonLocalized == entry.NonLocalized) {
if (str.Localized != entry.Localized) {
statusOutput.WriteLine("Updating localized RESX for '{0}' to '{1}'", str.Name, entry.Localized);
str.Localized = entry.Localized;
}
}
}
}
}
private void readPOToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.DefaultExt = ".po"; if (dialog.ShowDialog(this) == DialogResult.OK) { PoReader reader = new PoReader(dialog.FileName); List <PoEntry> entries = reader.ReadPo(); ApplyPo applyPo = new ApplyPo(); applyPo.Apply(entries, resourceDirectory, new StringWriter()); PopulateListView(); } }