private void synchronizeMenuItem_Click(object sender, EventArgs e) { SynchronizePOs dialog = new SynchronizePOs(); if (dialog.ShowDialog(this) != DialogResult.OK) { return; } PoAttributesDialog attributesDialog = new PoAttributesDialog(); if (attributesDialog.ShowDialog(this) != DialogResult.OK) { return; } PoWriterAttributes attributes = new PoWriterAttributes() { Name = attributesDialog.nameTextBox.Text, Email = attributesDialog.emailTextBox.Text, Version = attributesDialog.versionTextBox.Text, writePOT = true }; SynchronizePoFiles(dialog.ResXDirectory, dialog.PODirectory, attributesDialog.nameTextBox.Text, attributesDialog.emailTextBox.Text, attributesDialog.versionTextBox.Text); }
private void createPOTToolStripMenuItem_Click(object sender, EventArgs e) { PoAttributesDialog attributesDialog = new PoAttributesDialog(); if (attributesDialog.ShowDialog(this) != DialogResult.OK) { return; } PoWriterAttributes attributes = new PoWriterAttributes() { Name = attributesDialog.nameTextBox.Text, Email = attributesDialog.emailTextBox.Text, Version = attributesDialog.versionTextBox.Text, writePOT = true }; attributesDialog.Dispose(); SaveFileDialog dialog = new SaveFileDialog(); dialog.DefaultExt = ".pot"; if (dialog.ShowDialog(this) == DialogResult.OK) { PoWriter potWriter = new PoWriter(dialog.FileName, attributes); potWriter.WritePot(resourceDirectory); } }
private void SynchronizePoFile(string resxDirectory, string poDirectory, string baseName, CultureInfo culture, string programName, string email, string version, TextWriter statusOutput) { ResourceDirectory resourceDirectory = new ResourceDirectory(); statusOutput.WriteLine("Reading RESX directory '{0}' for culture '{1}'", resxDirectory, culture.Name); resourceDirectory.ReadFiles(resxDirectory, culture); resourceDirectory.ReadResources(); foreach (var resX in resourceDirectory.AllFiles) { statusOutput.WriteLine(" {0}", resX); } statusOutput.WriteLine(); string cultureName = culture.Name; if (cultureName.EndsWith("-NO")) { cultureName = cultureName.Substring(0, 2); } cultureName = cultureName.Replace("-", "_"); string poFileName = Path.Combine(poDirectory, baseName + "-" + cultureName + ".po"); statusOutput.WriteLine("Reading PO file '{0}' for culture '{1}'", poFileName, culture.Name); PoReader reader = new PoReader(poFileName); List <PoEntry> entries = reader.ReadPo(); ApplyPo applyPo = new ApplyPo(); applyPo.Apply(entries, resourceDirectory, statusOutput); resourceDirectory.WriteResources(); PoWriterAttributes attributes = new PoWriterAttributes() { Name = programName, Email = email, Version = version, writePOT = false }; PoWriter potWriter = new PoWriter(poFileName, attributes); potWriter.WritePot(resourceDirectory); }
private void SynchronizePot(string resxDirectory, string potFileName, string programName, string email, string version) { ResourceDirectory resourceDirectory = new ResourceDirectory(); resourceDirectory.ReadFiles(resxDirectory, CultureInfo.GetCultureInfo("en")); resourceDirectory.ReadResources(); PoWriterAttributes attributes = new PoWriterAttributes() { Name = programName, Email = email, Version = version, writePOT = true }; PoWriter potWriter = new PoWriter(potFileName, attributes); potWriter.WritePot(resourceDirectory); }
private void createPOTToolStripMenuItem_Click(object sender, EventArgs e) { PoAttributesDialog attributesDialog = new PoAttributesDialog(); if (attributesDialog.ShowDialog(this) != DialogResult.OK) return; PoWriterAttributes attributes = new PoWriterAttributes() { Name = attributesDialog.nameTextBox.Text, Email = attributesDialog.emailTextBox.Text, Version = attributesDialog.versionTextBox.Text, writePOT = true}; attributesDialog.Dispose(); SaveFileDialog dialog = new SaveFileDialog(); dialog.DefaultExt = ".pot"; if (dialog.ShowDialog(this) == DialogResult.OK) { PoWriter potWriter = new PoWriter(dialog.FileName, attributes); potWriter.WritePot(resourceDirectory); } }
private void SynchronizePoFile(string resxDirectory, string poDirectory, string baseName, CultureInfo culture, string programName, string email, string version, TextWriter statusOutput) { ResourceDirectory resourceDirectory = new ResourceDirectory(); statusOutput.WriteLine("Reading RESX directory '{0}' for culture '{1}'", resxDirectory, culture.Name); resourceDirectory.ReadFiles(resxDirectory, culture); resourceDirectory.ReadResources(); foreach (var resX in resourceDirectory.AllFiles) { statusOutput.WriteLine(" {0}", resX); } statusOutput.WriteLine(); string cultureName = culture.Name; if (cultureName.EndsWith("-NO")) cultureName = cultureName.Substring(0, 2); cultureName = cultureName.Replace("-", "_"); string poFileName = Path.Combine(poDirectory, baseName + "-" + cultureName + ".po"); statusOutput.WriteLine("Reading PO file '{0}' for culture '{1}'", poFileName, culture.Name); PoReader reader = new PoReader(poFileName); List<PoEntry> entries = reader.ReadPo(); ApplyPo applyPo = new ApplyPo(); applyPo.Apply(entries, resourceDirectory, statusOutput); resourceDirectory.WriteResources(); PoWriterAttributes attributes = new PoWriterAttributes() { Name = programName, Email = email, Version = version, writePOT = false }; PoWriter potWriter = new PoWriter(poFileName, attributes); potWriter.WritePot(resourceDirectory); }
private void synchronizeMenuItem_Click(object sender, EventArgs e) { SynchronizePOs dialog = new SynchronizePOs(); if (dialog.ShowDialog(this) != DialogResult.OK) { return; } PoAttributesDialog attributesDialog = new PoAttributesDialog(); if (attributesDialog.ShowDialog(this) != DialogResult.OK) return; PoWriterAttributes attributes = new PoWriterAttributes() { Name = attributesDialog.nameTextBox.Text, Email = attributesDialog.emailTextBox.Text, Version = attributesDialog.versionTextBox.Text, writePOT = true }; SynchronizePoFiles(dialog.ResXDirectory, dialog.PODirectory, attributesDialog.nameTextBox.Text, attributesDialog.emailTextBox.Text, attributesDialog.versionTextBox.Text); }
public PoWriter(string outputFilename, PoWriterAttributes attributes) { this.attributes = attributes; writer = new StreamWriter(outputFilename, false, new UTF8Encoding(false)); writer.NewLine = "\n"; // use UNIX style newlines. }