.NETGURU
Improving localization
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngreg' list.


Mike Connelly
-- Copied from [aspngwishlist] to [aspngreg] by Click here to reveal e-mail address --This is a multi-part message in MIME format.------=_NextPart_000_0001_01C13D26.1C5AAA40Content-Type: text/plain;    charset="us-ascii"Content-Transfer-Encoding: 7bitForgive me if this has been mentioned before. I am very new to ASP.NET. I have been experimenting with localization including resources andsatellite assemblies. I find resources relatively easy to create, albeitwith the requirement of manually converting the *.txt file to the*.resources file (which gets rote if you have more than 1 or twolanguages). After much use, I believe that *.resources are useless in a sharedhosting environment due to locking issues (particularly in the earlystages of translation of a new interface, when a .resources file changesconsiderably). I am unable to change the resources files (and converting*.txt to *.resources files generates exceptions due to the previous*.resources file for a given subculture) without rebooting thecomputer--and rebooting isn't an option in a shared hosting environment. As I understand it, the solution is to create a satellite assemblies.Beyond a strange error that I am receiving using al.exe, which preventsme from compiling: C:\INETPUB\WWWROOT\SOAPBOX\RESOUR~1>al /embed:strings.resources,strings.resources, y /out:strings.dllMicrosoft (R) Assembly Linker Version 7.00.9254 [CLR version v1.0.2914]Copyright (C) Microsoft Corp 2000-2001. All rights reserved.ALINK: error AL1047: Error importing file'C:\Inetpub\wwwroot\soapbox\resourcesstrings.resources' -- Unspecified error There is the larger issue....Why must the user manually create satellite assemblies or even convert*.txt files to *.resources files? As I understand it, *.aspx, *.ascx andsimilar files are compiled on the fly... Why can't we place localizationfiles in text or xml format in a folder, whether called "resources" orsomething else and have them automatically compiled whenever a change ismade to the source file--and ensure that the compiled version suffers nolocking issues? If this means automatically generating satelliteassemblies and placing them in the appropriate folders/subfolders in the/bin folder, great. Ultimately, the user should solely worry about consistency of fieldnameswithin the resource file and consistency of file name extensions. And,the user shouldn't need to differentiate between two methods ofgenerating such localization files (resources and satellite assemblies). A less important but related issue, there should be a central HTML pagethat lists international extensions rather than requiring the user tovisit a number of different standards body web sites to determine theproper suffix (i.e. pt-BR, ko-KR, ja-JP). This may be as simple asplacing a link to an existing page in the instructions for localization. Regards,Mike------=_NextPart_000_0001_01C13D26.1C5AAA40Content-Type: text/html;    charset="us-ascii"Content-Transfer-Encoding: quoted-printable<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =charset=3Dus-ascii"><TITLE>Message</TITLE><META content=3D"MSHTML 6.00.2526.0" name=3DGENERATOR></HEAD><BODY><DIV><FONT face=3DArial size=3D2><SPAN =class=3D594024217-14092001>Forgive me if this=20has been mentioned before. I am very new to ASP.NET.</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001></SPAN></FONT> </DIV><DIV><FONT face=3DArial size=3D2><SPAN class=3D594024217-14092001>I have =been=20experimenting with localization including resources and satellite =assemblies. I=20find resources relatively easy to create, albeit with the requirement of =manually converting the *.txt file to the *.resources file (which gets =rote if=20you have more than 1 or two languages).</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001></SPAN></FONT> </DIV><DIV><FONT face=3DArial size=3D2><SPAN class=3D594024217-14092001>After =much use, I=20believe that *.resources are useless in a shared hosting environment due =to=20locking issues (particularly in the early stages of translation of a new =interface, when a .resources file changes considerably). I am =unable to=20change the resources files (and converting *.txt to *.resources files =generates=20exceptions due to the previous *.resources file for a given subculture) =without=20rebooting the computer--and rebooting isn't an option in a shared =hosting=20environment.</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001></SPAN></FONT> </DIV><DIV><FONT face=3DArial size=3D2><SPAN class=3D594024217-14092001>As I =understand it,=20the solution is to create a satellite assemblies. Beyond a strange error =that I=20am receiving using al.exe, which prevents me from compiling:=20</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001>C:\INETPUB\WWWROOT\SOAPBOX\RESOUR~1>al=20/embed:strings.resources, strings.resources, y =/out:strings.dll<BR>Microsoft (R)=20Assembly Linker Version 7.00.9254 [CLR version v1.0.2914]<BR>Copyright =(C)=20Microsoft Corp 2000-2001. All rights reserved.</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN class=3D594024217-14092001>ALINK: =error AL1047:=20Error importing file=20'C:\Inetpub\wwwroot\soapbox\resources\<BR>strings.resources' -- =Unspecified=20error</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001></SPAN></FONT> </DIV><DIV><FONT face=3DArial size=3D2><SPAN class=3D594024217-14092001>There =is the larger=20issue....</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN class=3D594024217-14092001>Why =must the=20user manually create satellite assemblies or even convert *.txt =files to=20*.resources files? As I understand it, *.aspx, *.ascx and =similar=20files are compiled on the fly... Why can't we place localization files =in text=20or xml format in a folder, whether called "resources" or something=20else and have them automatically compiled whenever a change is made =to the=20source file--and ensure that the compiled version suffers no locking =issues? If=20this means automatically generating satellite assemblies and placing =them in the=20appropriate folders/subfolders in the /bin folder, great. =20</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001></SPAN></FONT> </DIV><DIV><FONT face=3DArial size=3D2><SPAN =class=3D594024217-14092001>Ultimately, the user=20should solely worry about consistency of fieldnames within the resource =file and=20consistency of file name extensions. And, the user shouldn't need to=20differentiate between two methods of generating such localization =files=20(resources and satellite assemblies).</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001></SPAN></FONT> </DIV><DIV><FONT face=3DArial size=3D2><SPAN class=3D594024217-14092001>A less =important but=20related issue, there should be a central HTML page that lists =international=20extensions rather than requiring the user to visit a number of =different=20standards body web sites to determine the proper suffix (i.e. =pt-BR, ko-KR,=20ja-JP). This may be as simple as placing a link to an existing page in =the=20instructions for localization.</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001></SPAN></FONT> </DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001>Regards,</SPAN></FONT></DIV><DIV><FONT face=3DArial size=3D2><SPAN=20class=3D594024217-14092001>Mike</SPAN></FONT></DIV></BODY></HTML>------=_NextPart_000_0001_01C13D26.1C5AAA40--
Reply to this message...
 
    
Trevor
Mike,

I too am trying to master the proper way to create satellite assemblies and
develop an application that supports multiple languages. I am not an
expert but I will try to help. If anyone reading suspects anything I am
saying is wrong... let me know !!!!

The company I am at we have an app that uses French and English. We use
XML files with .resx extensions instead of txt files.

RESGEN enLang.resx Lang.resources.
RESGEN enLang.resx Lang.en-CA.resources.
RESGEN frLang.resx Lang.fr-CA.resources.

re: manually creating the resource files and how its alot of
typing... The dot net quickstart/howto documentation suggests you create
a batch file. So say you need to generate a few resx files and embed a few
satellite assemblies... that way it only takes one line from dos. (which
is great if you have just downloaded a new project from sourcesafe) But...
For the resource to be a satellite assemblie (And don't quote me) but I
think you need to use the LINK command instead of the EMBED command.

Re: Locking issues. if you are reading your resource files directly from
the resource file instead of a .dll, you are right, you will encounter
locking issues.

ResourceManager RM = new CreateFileBasedResourceManager("whatever resource
file etc");

But... lets say you use a static resource manager property... Then the
resource file you point to from the page should stay in memory... and you
shouldn't need to open it more than once.

public admin
{
public static ResourceManager RM = new
CreateFileBasedResourceManager("whatever resource file etc");
}

say you have 250pages... Then you would have 250 resource managers in
memory... I'm not sure if this is a good or bad thing.

The app I have been exposed to actually has the two GIANT resource files
and all 200 pages read from that same resource file. The only disadvantage
to this is there are about 1500 labels in the file.

ie. RM.GetString("WhateverLabel")

So as far as maintenance... it would be interesting to see the file 3yrs
down the road. (Right now in some places we go
RM.GetString("SOMEPAGE.WhateverLabel");

I don't know if you've read in the DOT NET quickstart but there is a good
example... and they put the resource manager object in an application wide
variable (in the global.asax file) - So I can see this way
being better for performance... (Click on Working with resource files)

BUT ---- I'm not sure. because From Dot Net Beta 1 to Dot Net Beta 2 they
suddenly included a .resx file under each .cs file. So... It seems like
the way microsoft wants to go is to have separate resource files for each
page. I can see this being better because the resource manager doesn't
have to search through as many entries (ie. 30 labels vs. 2000 labels)...
maintenance will be better... etc. Its a hell of a lot better than pulling
the stuff out of a database table I think.

Anyways I agree that the DOT NET documentation is a little shady for the
resource manager. It seems in there documentation they have discussed
several different ways to do things but haven't suggested the proper
way. ie. We have too many choices right now.

Right now I'm trying to figure out how to let a user edit language
labels. ie. Say you have a resx file with the following

<data name="greeting">
<value>Hello</value>
</data>
<data name="smell">
<value>What smells?</value>
</data>

Somehow I want to read in all the labels and values. Then I want to edit
them... Then re-write them to the resx file... and re-write them as a
resource file... then someone reset the static RM property that holds the
resource file and load the new one. Not sure if I am making myself clear
or if anyone has done anything similiar. It just seems customers always
want power. And being able to edit language labels realtime is
important. If anyone has done this plz let me know how !!!!!!

[Original message clipped]

In internet explorer go

TOOLS -> Internet Options -> Languages -> Add . you will see a giant list.
(in dot net you can go Request.UserLanguages[0] or something and it gets it
from there.)

-Trevor

Reply to this message...
 
 
System.Resources.ResourceManager




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification