TranslateTool.ApplyPo.Apply C# (CSharp) Method

Apply() public method

public Apply ( List entries, ResourceDirectory resdir, TextWriter statusOutput ) : void
entries List
resdir ResourceDirectory
statusOutput System.IO.TextWriter
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;
                            }
                        }
                    }
            }
        }

Usage Example

Exemplo n.º 1
0
        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();
            }
        }
All Usage Examples Of TranslateTool.ApplyPo::Apply