|
Good Article.
I have a small doubt regarding Globalization/Localization. Hope you can help me out.
I have a web form application where i need to provide more than 50 different localized resource supports. Apart from this, my application supports rich use of stored data (Sql Server Database) and obviously have few list of Listing controls (Repeater , Grid etc).
My requirement comes like this,
a) I need to provide full localized language support in all data which is displaying in each and every page. Regardless of, the name of controls, content of controls etc. To be concise, which ever text that i am displaying through page, need to be localized based on user selected language.
b) Each and every setup needs to contain all supported languages. So user can switch and view content of site in different language.
I stuck in,
1) I am not sure how to localize stored data in database.
2) How will I give or from where i generate localized information for all supported language.
It would be grate if you can help me out through your valid comments.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I need to read some nonenglish context from a file and output it in TextBox. How do i inform the form what language to use? Language and Localization properties didn't work
|
|
|
|
|
I have a little app that generate resource files.
NOw i would like to press btnGenDLL and
this would create the bat file in the directory specified by the user
and the other bits and then run the al.exe programmatically.
Anybody any ideas how to do it?
thanks
vbnetuk@yahoo.co.uk
|
|
|
|
|
Where's the souce code download for the article? Harry
|
|
|
|
|
Well...
I don't really knows as i'm not the author of this article but you can take a look at
http://msdn.microsoft.com/msdnmag/issues/04/03/bugslayer/
or in your VS (2003) SDK at
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Technologies\Localization\CustomCulture
where an example is given.
If this can help you...
Best regards
Francis
|
|
|
|
|
It appears (after much trial and frustration) that the VS.NET IDE automatically parses all .resx files no matter whether or not they have a parent cs file. In building my resource files, I found if I just include the resource files directly into my project, then reference them as the resource base parameter when instantiating the ResourceManager object. For example, say you build localized resource files 'MyResource.LOCAL.resx' under the following folder:
\Include\Resources\*.resx
At build, the IDE will then compile those and automatically generate the \bin\LOCAL\*.dll for you.
So you'll end up with:
\bin\LOCAL (I.e. en-US)\PROJECT.resources.dll
Then in your C# code, just set the base to PROJECT.Include.Resources.MyResource an viola!
This occurred after having including my resource files into my project and continually having my generated *.dlls overriden each time I compiled. So now, I just include the resource files into my project, build, and the resource dlls are automatically generated.
|
|
|
|
|
I have create a resource manager in code
Friend rm As ResourceManager
I create a new instance of the resource manager
rm = New ResourceManager("BigByteTechnologies.LicenseManagement", Me.GetType().Assembly)
The application runs just fine but I can no longer edit the form.
This is a MDI form and the form name is frmMain, the exe name is LicenseManagement.exe which by the way I am creating with the intention of releasing here on codeproject as freeware to aid in creating licences for our apps
|
|
|
|
|
Hi
I want to store all my images within a resource file and then call them from my application. I am able to do this but things have changed and my application is not a .dll file that is called from a startup project which first checks for updates.
Where do i now put this resource dll and what do i call it, how do i display the images from this over forms in many projects?
Regards,
matt
|
|
|
|
|
Thanks for the article - it taught me what I needed to know. I am using the satellite assembly technique for my web app, and have created a batch file that makes it real simple to update my resource file. Maybe some others can benefit from it - it goes something like this (UpdateZH.bat):
<br />
path=%path%;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\WINNT\Microsoft.NET\Framework\v1.1.4322<br />
<br />
resgen MyResource.ZH-cn.txt<br />
al.exe /t:lib /embed:MyResource.zh-cn.resources,MyApp.MyResource.zh-cn.resources /culture:zh-CN /out:MyApp.resources.dll<br />
move MyApp.resources.dll bin\zh-cn<br />
<br />
pause<br />
To use, replace MyApp with your assembly name, myresource with your resource name, and zh-CN with your culture identifier.
|
|
|
|
|
Thanks Steven,
Anything to make me go faster is a help.
|
|
|
|
|
Hi ,
Your article helped me a lot. But one point i have strucked assumption is that my existing assembly is strong named , now if i want to attached the locale specific it is fine if my created app is not strong named .If the app is strongly named , what are the other parameters should i use for the al.exe
Thanks
Roopesh
|
|
|
|
|
Hi,
you should use "/template:<your-assembly-with-strong-name>". Assembly linker will use your assembly's metadata to construct satellite assembly.
Wizard_01
|
|
|
|
|
Hi,
you should use "/template:<your-assembly-with-strong-name>". Assembly linker will use your assembly's metadata to construct satellite assembly.
Wizard_01
|
|
|
|
|
Hi,
you should use "/template:<your-assembly-with-strong-name>". Assembly linker will use your assembly's metadata to construct satellite assembly.
Wizard_01
|
|
|
|
|
I too am having issues with my application that I want to associate the satellite assembly with is strongly named.
I have tried using the /template option and this is not working.
I have also tried using the /keyfile option to use the same public/private key pair as I used in the main application.
If anyone knows something about this, please let us know!
Thanks
|
|
|
|
|
In the short time since I posted this, I finally found a fix for the issue!
To credit the source, it came from here:
http://www.codeguru.com/csharp/.net/net_general/tipstricks/article.php/c11367/
Below is the section that worked for me, where I needed to use the /template and /keyfile options together, AND it must use the same keyfile as the main application, according to the article.
al /embed:ExploreDotNet2005.Strings.en-US.resources
/out:ExploreDotNet2005.resources.dll /c:en-US
/template:../ExploreDotNet2005.exe /keyfile:../../..
/KeyPair.snk
|
|
|
|
|
I am sorry, may be what I will say have little connection with this subject.
I am now working on the localization of a product. I think what I should do is to create resource files in other language.
The string table editor of VC6 is not easy to use for non-developers.
I wonder if we could maintain the string table in an excel file just like "Writing Code for International Use" in MSDN. It will be easy for a group of non-editors to working on it and it is easy to review.
I wish what I have said make some sense.
With Regards,
Yours,
Ning Cao
|
|
|
|
|
Check out http://www.codeproject.com/tools/localizerc.asp which at least extracts all strings out of Your resources to a text file.
|
|
|
|
|
Actually this was exactly what i have been using for a year..
They use MS Excel to create multi language applications.
i dontnow if it is OK to write url of the tool because it si not free.
check www.swbox.com - tool called: StringDB
coldstone
|
|
|
|
|
You don't need to use the VS resource editor to modify the resource files. The .resx files are XML, which can be edited with a text editor or XML editor.
|
|
|
|
|
Nice article.
Once you create an satellite assembly then only you can make use of that. Iam not sure, isnt it pain to create satellite assembly each time you modify the resource file ? I am not sure is there any way to avoid this ?
Another question depending on the culture of the client I need to call the satellite assembly. How can I find this during runtime and call the appropriate satellite assembly?
Please let me know.;)
|
|
|
|
|
Hi Sreenath,
Once you compile your resource file into satellite assembly(e.g a DLL),therotically anyone with same assembly name and same resource key values can make use of it,however it is difficult to have a coincidence like this Yeah,its pain to create satellite assembly each time you need to make some changes or add some more keys t your resource file,but I guess one has to live with it .This sounds practical also,since you don’t need to compile your solution for adding a satellite assembly.Its just a matter of placing the satellitle assembly(can be a DLL) at apprpriate location in yourproject manifest. One easier option can be using file based resource manager explained in my article as an alternative.
Further in response to your next query,yeah you need to know the intended culture of a clinet to load appropriate
satellite assembly.Typically, for a Web Application you have client's/visitor's information stored in database. You can store preferred locale(may be multiple locales) for a customer in DB & upon his/her logon into your application, you can present him/her the content in his/her preferred locale or you can prompt them to choose one of their preferred locale. You take this locale as your input for cultureInfo in GetString method of ResourceManager class(Refere my article).This will enable correct loading of satellite assembly.
Let me know, if you understood the concept.
Rgds:
Prakash Kumar Singh
MCAD(Microsoft Certified Application Developer for .NET)
|
|
|
|
|
Mister Prakash Kumar Singh
Thanks for this article. Very interesting. Got two remarks on it. For a multilingual application it's rather hard to keep the strings in several separate files and when you make a asp.net application, you have one resx per web page.
Secondly, the resx file should be translated by a person who is not coder, so need the data in tabular format in word ou excel.
Have you tried another ways of making application multilingual ? We are currently considering the way to externalise all the labels in a database and translate the web page on pre-render moment. Each label contains the main text (for easy coding and design mode visualising) and the label code. Then it is easy to parse page controls on pre-render and get the translations from db.
Any suggestions for that ?
Thanks
Dimitri (d3311 hotmail com)
|
|
|
|
|
you should check out esperantus on sourceforge.
http://sourceforge.net/projects/esperantus
|
|
|
|