Bug Localization file keeps on resetting

 
  • Created:over 2 years ago
  • Modified:over 2 years ago by birkoff
  • Status:by-design
  • Owner:unassigned
  • Related:#3244 , #7060
no supporters

Hi,

I want to localize MB and Subdued theme to Hebrew.

I have read the localization KB, Where it said:

NOTE: If your translations in the xml file mysteriously disappear, then check the encoding of that file. The correct encoding should be ‘UTF-8 without BOM’. Convert to ‘UTF-8 without BOM’ BEFORE any translations, eg. with Notepad++

I did the above but the localization file : Subdued-strings-he.xml and strings-he.xml keep on resetting back to English.

Is there a problem with the Hebrew language?

Thanks, Tempo

 
votes newest oldest
 
  • Created:over 2 years ago

I think you have to make sure you add the approriate version to te strings file. If the version tag is set to something below the one in the code it will reset the strings file

 
  • If that’s the case, the version in the theme is 1.0001 (don’t ask, it was 1.0000 and because I actually made changes, I bumped it). So try setting the version tag in your strings file to that. – rwhapham over 2 years ago
  • Also be sure you don’t have any whitespace or line breaks in the version tag. – rwhapham over 2 years ago
  • Actually, if this is the case…that stinks for translation files. They'll always be different. If this turns out to be the case, I'd say it’s a bug and should be fixed in MB core. – sinjen over 2 years ago
 
  • Created:over 2 years ago

In the MyStrings.cs that is generated when creating a new theme, there is the following:

const string VERSION = "1.0001"; //this is used to see if we have changed and need to re-save

... 

public static MyStrings FromFile (string file)
{
    MyStrings s = new MyStrings ();
    XmlSettings<MyStrings> settings = XmlSettings<MyStrings>.Bind (s, file);

    Logger.ReportInfo ("Using String Data from " + file);

    if (VERSION != s.Version)
    {
        File.Delete (file);
        s = new MyStrings ();
        settings = XmlSettings<MyStrings>.Bind (s, file);
    }
    return s;
}

So, if the version tag in the string file is not equal (not even a numeric comparison) to the constant compiled in with the theme, the file is deleted and reset with the base strings. Not sure if MB core does this as well; but, you're right, it’s not very straightforward and leaves the door open to string files being “accidentally” reset if a theme changes its string version.

 
  • I agree that the initial strings file should behave this way. My contention is that it shouldn’t be resetting “custom” localized versions. – sinjen over 2 years ago
  • But then what happens when a theme developer adds new strings, if the file is not overwritten it may bomb in MCML if no string is found and your binding to a text element. I'm not sure if it crashes or not it may simply just return a blank string… – throgmorton over 2 years ago
  • Ok, so what we'll probably have to do is load the English version if the versions don’t match. But, IMO, we should never over write a translation of say, Dutch and stick English into the file. We should throw a message into the log, and then load the known good English version (or whatever the theme’s base strings file is). But destroying the translation shouldn’t happen. Again, just my opinion. – sinjen over 2 years ago
  • I agree that the original custom strings file shouldn’t be overwritten, I left it like that because that’s how it was for MB and didnt want to break anything – throgmorton over 2 years ago
  • What would be helpful is an editor that pulled in the original strings and the custom strings you wanted to edit so you could visually see if there were new ones added or not. (And, no, I wasn’t volunteering…yet.) That way, we could always leave custom string files alone, but it would be easier to bring them up-to-date. – rwhapham over 2 years ago
 
  • Created:over 2 years ago

Hi,

Thank you guys for that info i will check it.

does the Subdued-strings-he.xml and strings-he.xml need to have the same version or the subdued xml has one version an MB has another?

p.s

when translating MB will use Subdued-strings-he.xml and strings-he.xml together in order to localize all of the strings, not just the subdued one, right?

Thanks, Tempo

 
  • To further confuse things, no, they are not the same version. And, other than looking at the source code, or having someone publish what they are, there is really no way for the “casual” user to know. The strings file for Draco is currently at 1.0016; Subdued is 1.0001. And, yes, MB uses the two in combination. Not sure about all themes, but Subdued uses some strings from the main strings file—no need to make people translate the same thing multiple times. At least that was my thinking. Though I can see an argument for having ALL of a theme’s strings in its string file for completeness sake. – rwhapham over 2 years ago
 
  • Created:over 2 years ago

Hi,

I managed to make it work by using the version tag as you suggested.

I will have MB and Subdued Hebrew translation hopefully by the end of next week :D

so far it looks good :)

 
  • Just make sure you always keep a backup of your translation files in case the version ever changes again. – sinjen over 2 years ago
  • that’s what I did ;) – Tempo over 2 years ago
  • so can we close this? – birkoff over 2 years ago
  • sure :) – Tempo over 2 years ago