示例#1
0
        private void BN_ConvertCsvToPo_Click(object sender, EventArgs e)
        {
            OpenFileDialog CsvFileInfo = new OpenFileDialog();

            CsvFileInfo.Filter           = ".csv (*.csv )|*.csv";
            CsvFileInfo.InitialDirectory = TXBX_UE4LocalizationPath.Text;
            if (CsvFileInfo.ShowDialog() == DialogResult.OK)
            {
                FileInfo FindPoFile = new FileInfo(CsvFileInfo.FileName);
                if (FindPoFile.Exists)
                {
                    SaveFileDialog SavePo = new SaveFileDialog();
                    SavePo.Filter           = FindPoFile.Name.Replace(FindPoFile.Extension, "") + ".po (*.po )|*.po";
                    SavePo.FileName         = FindPoFile.Name.Replace(FindPoFile.Extension, "") + ".po";
                    SavePo.InitialDirectory = TXBX_MainPoFile.Text;
                    if (SavePo.ShowDialog() == DialogResult.OK)
                    {
                        PoFile NewPoFile = Utilities.ConvertCsvToPoFile(FindPoFile);

                        FileInfo SavePoInfo = new FileInfo(SavePo.FileName);
                        NewPoFile.SaveFile(SavePoInfo);
                    }
                }
            }
        }
示例#2
0
        public void ReadTestDeNewLine()
        {
            var po = new PoFile();
            po.LoadFromFile("../../Files/de.po");

            Assert.Equal("Neue\nZeile 1", po.GetString("New\nLine 1"));
            Assert.Equal("Neue\nZeile 2", po.GetString("New\nLine 2"));
        }
示例#3
0
文件: PoFile.cs 项目: xyfc/nettext
        public void ReadTestDeNewLine()
        {
            var po = new PoFile();

            po.LoadFromFile("../../Files/de.po");

            Assert.Equal("Neue\nZeile 1", po.GetString("New\nLine 1"));
            Assert.Equal("Neue\nZeile 2", po.GetString("New\nLine 2"));
        }
示例#4
0
        private void BN_CreateLocalizationCSV_Click(object sender, EventArgs e)
        {
            DirectoryInfo UE4LocalizationPath = (DirectoryInfo)settingsControl.GetValue("UE4LocalizationPath");
            string        PoFileName          = UE4LocalizationPath.Name + ".po";
            int           KeyCell             = (int)settingsControl.GetValue("KeyCell");
            int           SourceCell          = (int)settingsControl.GetValue("SourceCell");
            int           SourceLocationCell  = (int)settingsControl.GetValue("SourceLocationCell");

            if (UE4LocalizationPath.Exists)
            {
                List <LanguageCell>  Languages        = new List <LanguageCell>();
                List <cl_ListKeyInt> languageListCell = (List <cl_ListKeyInt>)settingsControl.GetValue("LanguageListCellID");
                foreach (cl_ListKeyInt item in languageListCell)
                {
                    Languages.Add(new LanguageCell(item.Key, item.value));
                }

                FileInfo PoFIlePath = (FileInfo)settingsControl.GetValue("UE4MainPoFile");

                SaveFileDialog SaveCSV = new SaveFileDialog();
                SaveCSV.Filter           = PoFIlePath.Name.Replace(PoFIlePath.Extension, "") + ".csv (*.csv )|*.csv";
                SaveCSV.FileName         = PoFIlePath.Name.Replace(PoFIlePath.Extension, "") + ".csv";
                SaveCSV.InitialDirectory = PoFIlePath.FullName;

                if (SaveCSV.ShowDialog() == DialogResult.OK)
                {
                    LocalizationFile NewLocalizationFileInfo = new LocalizationFile();
                    NewLocalizationFileInfo.KeyCell            = KeyCell;
                    NewLocalizationFileInfo.SourceLocationCell = SourceLocationCell;
                    NewLocalizationFileInfo.SourceCell         = SourceCell;
                    NewLocalizationFileInfo.Languages          = Languages;



                    PoFile NewPoFile = new PoFile(PoFIlePath);
                    NewLocalizationFileInfo.AddPoFileSource(NewPoFile);

                    foreach (LanguageCell Language in Languages)
                    {
                        FileInfo PoFIleLanguagePath = new FileInfo(Path.Combine(UE4LocalizationPath.FullName, Language.Language, PoFileName));

                        if (PoFIleLanguagePath.Exists)
                        {
                            PoFile NewPoFileLanguage = new PoFile(PoFIleLanguagePath);
                            NewLocalizationFileInfo.AddPoFile(NewPoFileLanguage, Language);
                        }
                    }

                    FileInfo ToSaveFile = new FileInfo(SaveCSV.FileName);
                    NewLocalizationFileInfo.SaveFile(ToSaveFile);

                    MessageBox.Show("File is saved!");
                }
            }
        }
示例#5
0
        public void ReadTestDeUntranslated()
        {
            var po = new PoFile();
            po.LoadFromFile("../../Files/de-untranslated.po");

            Assert.Equal("File", po.GetString("File"));
            Assert.Equal("File", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} file", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} files", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} files", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }
示例#6
0
        public void ReadTestDePartially()
        {
            var po = new PoFile();
            po.LoadFromFile("../../Files/de-partially.po");

            Assert.Equal("Datei", po.GetString("File"));
            Assert.Equal("File", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} Datei", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} files", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} file", po.GetParticularPluralString("some context", "{0} file", "{0} files", 1));
            Assert.Equal("{0} Dateien", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }
示例#7
0
文件: PoFile.cs 项目: xyfc/nettext
        public void ReadTestDeUntranslated()
        {
            var po = new PoFile();

            po.LoadFromFile("../../Files/de-untranslated.po");

            Assert.Equal("File", po.GetString("File"));
            Assert.Equal("File", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} file", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} files", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} files", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }
示例#8
0
        public void HeaderTest()
        {
            var po = new PoFile();

            po.LoadFromFile("../../Files/de.po");
            Assert.Equal("de", po.GetHeader("Language"));

            po.LoadFromFile("../../Files/ru.po");
            Assert.Equal("ru", po.GetHeader("Language"));

            po.LoadFromFile("../../Files/pl.po");
            Assert.Equal("pl", po.GetHeader("Language"));
        }
示例#9
0
文件: PoFile.cs 项目: xyfc/nettext
        public void ReadTestDePartially()
        {
            var po = new PoFile();

            po.LoadFromFile("../../Files/de-partially.po");

            Assert.Equal("Datei", po.GetString("File"));
            Assert.Equal("File", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} Datei", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} files", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} file", po.GetParticularPluralString("some context", "{0} file", "{0} files", 1));
            Assert.Equal("{0} Dateien", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }
示例#10
0
文件: PoFile.cs 项目: xyfc/nettext
        public void ReadTestPl()
        {
            var po = new PoFile();

            po.LoadFromFile("../../Files/pl.po");

            Assert.Equal("plik", po.GetString("File"));
            Assert.Equal("plik", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} plik", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} pliki", po.GetPluralString("{0} file", "{0} files", 2));
            Assert.Equal("{0} pliko'w", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} pliko'w", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }
示例#11
0
文件: PoFile.cs 项目: xyfc/nettext
        public void ReadTestRu()
        {
            var po = new PoFile();

            po.LoadFromFile("../../Files/ru.po");

            Assert.Equal("Файл", po.GetString("File"));
            Assert.Equal("Файл", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} Файл", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} Файла", po.GetPluralString("{0} file", "{0} files", 2));
            Assert.Equal("{0} Файлов", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} Файлов", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }
示例#12
0
文件: PoFile.cs 项目: xyfc/nettext
        public void HeaderTest()
        {
            var po = new PoFile();

            po.LoadFromFile("../../Files/de.po");
            Assert.Equal("de", po.GetHeader("Language"));

            po.LoadFromFile("../../Files/ru.po");
            Assert.Equal("ru", po.GetHeader("Language"));

            po.LoadFromFile("../../Files/pl.po");
            Assert.Equal("pl", po.GetHeader("Language"));
        }
示例#13
0
        private void BN_CreatePoFiles_Click(object sender, EventArgs e)
        {
            FileInfo PoFileInfo = (FileInfo)settingsControl.GetValue("UE4MainPoFile");
            PoFile   NewPoFile  = new PoFile(PoFileInfo);

            DirectoryInfo PoMainDirectors = (DirectoryInfo)settingsControl.GetValue("UE4LocalizationPath");

            FolderBrowserDialog objDialog = new FolderBrowserDialog();

            objDialog.Description  = "Choose the Project localization path";
            objDialog.SelectedPath = PoMainDirectors.FullName;
            DialogResult objResult = objDialog.ShowDialog(this);

            if (objResult == DialogResult.OK)
            {
                FileInfo LocalizationFileInfo = (FileInfo)settingsControl.GetValue("LocalizationCSV");
                if (LocalizationFileInfo.Exists)
                {
                    List <LanguageCell>  Lang             = new List <LanguageCell>();
                    List <cl_ListKeyInt> languageListCell = (List <cl_ListKeyInt>)settingsControl.GetValue("LanguageListCellID");
                    foreach (cl_ListKeyInt item in languageListCell)
                    {
                        Lang.Add(new LanguageCell(item.Key, item.value));
                    }

                    int KeyCell            = (int)settingsControl.GetValue("KeyCell");
                    int SourceCell         = (int)settingsControl.GetValue("SourceCell");
                    int SourceLocationCell = (int)settingsControl.GetValue("SourceLocationCell");
                    LocalizationFile NewLocalizationFileInfo = new LocalizationFile(LocalizationFileInfo, Lang, KeyCell, SourceCell, SourceLocationCell);
                    if (NewLocalizationFileInfo.LanguageValues.Count > 0)
                    {
                        foreach (LanguageCell Language in NewLocalizationFileInfo.Languages)
                        {
                            PoFile NewLanguagePoFile     = Utilities.CreatePofileFromLocalizationCSV(NewLocalizationFileInfo, Language.Language);
                            PoFile CombineLanguagePoFile = Utilities.CombinePoFiles(NewPoFile, NewLanguagePoFile);

                            FileInfo ToSavePo = new FileInfo(Path.Combine(objDialog.SelectedPath, Language.Language, PoFileInfo.Name));
                            if (!ToSavePo.Directory.Exists)
                            {
                                Directory.CreateDirectory(ToSavePo.Directory.FullName);
                            }

                            CombineLanguagePoFile.SaveFile(ToSavePo);
                        }
                    }

                    MessageBox.Show("Files are created!");
                }
            }
        }
示例#14
0
        private void BN_ConvertPoToCsv_Click(object sender, EventArgs e)
        {
            OpenFileDialog FindPoFile = new OpenFileDialog();

            FindPoFile.Filter           = "*.po (*.po )|*.po";
            FindPoFile.InitialDirectory = TXBX_UE4LocalizationPath.Text;
            if (FindPoFile.ShowDialog() == DialogResult.OK)
            {
                FileInfo PoFileInfo = new FileInfo(FindPoFile.FileName);

                SaveFileDialog SaveCSV = new SaveFileDialog();
                SaveCSV.Filter           = PoFileInfo.Name.Replace(PoFileInfo.Extension, "") + ".csv (*.csv )|*.csv";
                SaveCSV.FileName         = PoFileInfo.Name.Replace(PoFileInfo.Extension, "") + ".csv";
                SaveCSV.InitialDirectory = TXBX_MainPoFile.Text;
                if (SaveCSV.ShowDialog() == DialogResult.OK)
                {
                    if (PoFileInfo.Exists)
                    {
                        PoFile NewPoFile = new PoFile(PoFileInfo);
                        Utilities.ConvertAndSavePoToCsv(NewPoFile, new FileInfo(SaveCSV.FileName));
                    }
                }
            }
        }
示例#15
0
        public void ReadTestPl()
        {
            var po = new PoFile();
            po.LoadFromFile("../../Files/pl.po");

            Assert.Equal("plik", po.GetString("File"));
            Assert.Equal("plik", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} plik", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} pliki", po.GetPluralString("{0} file", "{0} files", 2));
            Assert.Equal("{0} pliko'w", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} pliko'w", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }
示例#16
0
        public void ReadTestRu()
        {
            var po = new PoFile();
            po.LoadFromFile("../../Files/ru.po");

            Assert.Equal("Файл", po.GetString("File"));
            Assert.Equal("Файл", po.GetParticularString("some context", "File"));
            Assert.Equal("{0} Файл", po.GetPluralString("{0} file", "{0} files", 1));
            Assert.Equal("{0} Файла", po.GetPluralString("{0} file", "{0} files", 2));
            Assert.Equal("{0} Файлов", po.GetPluralString("{0} file", "{0} files", 5));
            Assert.Equal("{0} Файлов", po.GetParticularPluralString("some context", "{0} file", "{0} files", 5));
        }