Exemple #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();
            }
        }
Exemple #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);
        }
Exemple #3
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);
        }
Exemple #4
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();
     }
 }