Loading...
 
Multi-Language Add-In for Visual Studio

Multi-Language Add-In for Visual Studio


Why ASP App needs XML file to work?

Our company bought your product and we used it to generate resources for our ASP web application. All the resources from Web project (from c# code and ascx code behind) were placed (worked well!) in App_GlobalResources in 3 files - all string got numbered ID in files:

MultiLang.en-GB.resx
MultiLang.pl-PL.resx
MultiLang.resx

but also in XML file placed in App_Code directory. The problem is that IDs in ascx files (ex: meta:resourcekey="ML_0002") don’t match those in resx files (ex: 0013) and the XML file is the item that matches one key to the another. We would like to have all resources matched directly without XML workaround.

My question is how does it really works? The ml.ml_string string class is responsible for getting resources for code files (*cs) and it works fine but we have no idea how resources from control files works – it seems they need xml file and without it application won’t work. What mechanism is responsible for matching IDs in meta:resourcekey with tags in XML files and afterwards in RESX files? Will it work after deployment on our client server ? Your software is installed only on developers machines and we cannot install it on main server, and it seems to me that your software somehow magically do the matching….

Germany

The meta:resourcekey refers to resources in the so called Local resource file.

The local resource file has the same name as the web page, and is in the App_LocalResources directory.

For example, for a web page default.aspx, there should be a resource file App_LocalResources\default.resx, and localized versions, e.g. App_LocalResources\default.en-GB.resx or App_LocalResources\default.pl-PL.resx.

The local resource file contains named resources for the localizable attributes of the tag, in the form keyname.attributename

The project database project_ml.xml is not used at runtime.

You can find more information about how the meta:resourcekay mechanism works by searching for "implicit localization" in the visual studio help (or for "ASP implicit localization" in google).

The local resource files should be automatically generated by the Add-In. You can force the Add-In to update these files with the command "Store resources for web projects" under the third button on the Add-In's toolbar. With the latest version of the Add-In, this should never be necessary.

By the way, the numbers used in the names ML_nnnn are not related to the string IDs. I think that the ML_nnnn names are only generated if the ASP tag does not have an id attribute. If it has an id attribute, then the Add-In will use the same name for the meta:resourcekey attribute.

Best regards
Phil


We used program version: 4.65.0054 and it didn't produce any Local Resources - only 3 RESX files in global resources and XML project database. All strings form project (form .cs files and from ascx and aspx files also, and we had nearly 3000 of them in control files, Buttons, Literals etc.) are placed there. Program added ML_XXXX key for each control even if the had proper ID. We used only default settings. We exported strings to Excel file and sent it already to translators – all strings were there. We are not sure that after the translated strings come back we will be able to run Multilanguage app correctly – we tried to import the Excel file with test translations and it works only for some places in app – not all of them. Could you suggest any solution to this problem?
Germany

Hi,

I will take a closer look at this later today, but I have one quick bit of advise.

With that version, I don't think that the resource files were generated automatically. This was an error, which I fixed in version 4.65.0072.

You can force the Add-In to generate the resource files with the command "Store resources for web projects" in the Runtime support menu. I think that this is third button on the toolbar.

Phil

Germany

It looks like you are right about the ML_nnnn resource keys. The Add-In always generates a resource key in this form, even if the tag has an ID field.

I think I would prefer it to use the ID as the resource key if possible. There may have been a problem doing this, for example some case in which the ID is not unique on a page. This is not a big issue, but I will take another look at it. I think it would help the usability if the names were identical.

Can you try using the command "Store resources for web projects" and let me know if it generates the resource files?

Phil

Is this issue solved? post in this thread
I would like to have the ID as the resource key but I only get ML_nnnn. I can't see a problem that the ID is not unique and I also haven't found an option in the settings.
Uli

Germany

Hi Uli,

good question. Unfortunately, it was not solved. However, I have just uploaded a new version (4.7x.0120) which should fix it.

The new version will use ID as the resourcekey, if the ID is defined and if no other resourcekey has been defined. It will not actively change the resourcekey if it has already been defined. To achieve this you would have to deselect the attribute(s) in the tag, so that the resourcekey is removed, rescan the module (which makes the Add-In forget the previous resourcekey), and then reselect the attribute(s).

There is one exception. I believe that the IDs are not necessarily unique if they are used within a template. I don't know why this is, but I'm pretty sure that I have seen examples. Therefore, if the tag is inside a template, then the ID will not be used as the resourcekey.

Phil

One more detail. When a literal has already a resource key (my workaround) the ID gets changed to that resource key name. This seems only happen with literals, but the ID should never be changed.
Uli

PS: A nice optional feature for future versions would be a possibility to choose/define a name for new literals befor the name of the resource key is defined. (I don't like the ML_nnnn-Names.)


We used "Store resources for web projects", worked well! Now we are re-scanning project to make sure all strings are in those resources but this everything seems to be working fine.
Thanks!
Best regards!