public LocString(ResXFile file, string name, string nonLocalized, string comment) { this.File = file; this.Name = name; this.NonLocalized = nonLocalized; this.Comment = comment; }
string GetResourcesName(ResXFile resxFile, string directoryPath) { string newFileName = Path.Combine(directoryPath, Path.GetFileName(resxFile.LocalizedFileName)); newFileName = Path.ChangeExtension(newFileName, ".resources"); return(newFileName); }
public void WriteResources() { string filename = GetTestFile("AboutForm.resx"); ResXFile resXFile = new ResXFile(filename, new CultureInfo("fr")); resXFile.Read(); LocString str = resXFile.GetString("label1.Text"); str.Localized = "Foo"; resXFile.Write(); resXFile = new ResXFile(filename, new CultureInfo("fr")); resXFile.Read(); ICollection<LocString> strings = resXFile.AllStrings; foreach (LocString locstr in strings) { Console.WriteLine("Name:{0} NonLocValue:{1} LocValue:{2} Comment:{3}", locstr.Name, locstr.NonLocalized, locstr.Localized, locstr.Comment); } }
public void ResXFileName() { string filename = GetTestFile("AboutForm.resx"); ResXFile resXFile = new ResXFile(filename, new CultureInfo("de")); Assert.AreEqual(filename, resXFile.NonLocalizedFileName, true); Assert.AreEqual(GetTestFile("de\\AboutForm.de.resx"), resXFile.LocalizedFileName, true); Assert.AreEqual("de", resXFile.Culture.Name); }
// Convert one resxFile. Returns true on success. bool ConvertResX(ResXFile resxFile, string directoryPath) { int exitCode = programRunner.Run(resgenExeName, string.Format("\"{0}\" \"{1}\"", resxFile.LocalizedFileName, GetResourcesName(resxFile, directoryPath)), Path.GetDirectoryName(resxFile.LocalizedFileName)); return(exitCode == 0); }
string GetResourcesName(ResXFile resxFile, string directoryPath) { string newFileName = Path.Combine(directoryPath, Path.GetFileName(resxFile.LocalizedFileName)); newFileName = Path.ChangeExtension(newFileName, ".resources"); return newFileName; }
// Convert one resxFile. Returns true on success. bool ConvertResX(ResXFile resxFile, string directoryPath) { int exitCode = programRunner.Run(resgenExeName, string.Format("\"{0}\" \"{1}\"", resxFile.LocalizedFileName, GetResourcesName(resxFile, directoryPath)), Path.GetDirectoryName(resxFile.LocalizedFileName)); return exitCode == 0; }