Multi-Language Add-In for Visual Studio

Multi-Language Add-In for Visual Studio


ml.ml_string() return null for "new" strings..? (and a few other things)

Hi again - and sorry about all the posts.. We are making a huge localization review of current strings used, added new strings and adding new languages.

Some strings return null (I estimate the "last" 50% of the strings added is having this issue).
Looking at the code, I can see resource files for all my languages multiple places (simplified example without all local resources):

  1. /{projectname}/App_LocalResources/{filename}.aspx.{language}.resx
  2. /{projectname}/App_GlobalResources/MultiLang.{language}.resx
  3. /{projectname}/MultiLang.{language}.resx


Let me explain what I see in each "type" of file:

  1. Contains only the strings required for the file (no strings is missing)
  2. Should contain all strings, but is missing (some) of the "new" strings
  3. Contains all strings and looks up to date


Based on my own little humble assessment, it seems like either (3) should have replaced (2) OR "ml" class should get the strings from (3) instead of (2).

(3) is new to me - and something I didn't have in previous versions of MultiLang (at least I think so). Before this translation round, I updated the tool to latest version. I changed translation scope to solution scope (from project scope) and I've added both new languages and new strings.

I currently made a hack to avoid errors in my UI where new strings is failing, so I'm still being able to display "original string" instead of whole page is throwing an exception:

public static string ml_string ( int StringID, string Text )
{
    // Resource IDs are now prefixed with "_"
    var res = ResMgr.GetString ( "_" + StringID.ToString() ) ;         //DontTranslate

    if (res == null) 
        res = Text; //TODO: FIX THIS HACK !!!!!

    return res;
}


------------------------------------------------------------------------

A few other "minor" issues.

  • When I add/select a string from e.g. ListItem.Text - it will sometimes add ListItem.Value as well (and that makes no sense). It never makes sense in my solution to translate a ListItem.Value.
  • Strings "hidden" (neve to be translated) seems to again sometimes being added in above scenario (Text/Value) and sometimes they are "just" added to the list of "Unused Strings" (making it impossible to clean up the list of "Unused Strings").
  • MlString.cs was added to "App_Code", and for "Web Application" this is bad practice ("ml" class will reside in 2 dll files).
  • Solution scope is great in theory, but we have multiple solutions to handle same product. It would be a lot better if we could either get a "global compact sql scope" (without polluting the current "global database") or if "solution scope" meant a project was added to solution (and this project could be shared between solutions
Germany

I made a change in version 5.0x.0044 in September 2012 to store MultiLang.resx in the project directory instead of in App_GlobalResources, for a Web Application (but not a web site). I'm pretty sure I modified the template for the ml_string function to access this directory, but it would only copy the modified template to a new project.

The template file is installed to

c:\Users\Public\Documents\MultiLang\Templates\WebApplications\CS\MlString.cs

(although that might vary according to the version of Windows).

Maybe you compare your file to the template.

In addition, I stopped adding MlString.cs to App_Code for Web applications even longer ago. Probably in version 4.7x.0090 in July 2011. Again, this would only affect new projects. If MlString.cs is already in the Add_Code directory, the Add-In doesn't move it.

I had another link about this issue http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx, about half way down after VERY VERY IMPORTANT.

I will look at the other issues later (probably at the week end).

Phil


Okay - sounds like I might got caught in some migration. Unfortunately, I don't know my previous version, as I was just downloading the new without noting the difference. However I should be able to figure out the old version by looking in my source control.

I found the template file, manually replaced the existing one with this and changed project name. I note "SupportedCultures" attribute is not part of template - I guess it will add it next time I add use the tool (scan? add language? or..?)

Initial assessment tells me this fixed the issue - but I will have to investigate.
Should (or can) I manually delete old resx files from App_GlobalResources folder?

Thanks for looking into my issues! :-)


Did you have time to look at my issues?