예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }