Resource file vs. regular Xml file

  • Thread starter Thread starter TS
  • Start date Start date
T

TS

i have a need to possibly enable mutli language support. What benefit do i
get by using a resource file instead of a custom xml solution?

thanks!
 
TS said:
i have a need to possibly enable mutli language support. What benefit do i
get by using a resource file instead of a custom xml solution?

thanks!

I don't know what your "customer xml solution" is ? You store all
information of controls such as text, color value (#aabbcc) in a regular
xml file, doesn't you ?
As far as I know, ASP.NET support resource file very well. So you
either need a multi languages or not, you should use Resource Feature in
your ASP.NET.
 
Hi TS,

I think the main advantage of using .NET resource file(or resx file) is
that you can make full use of the built-in API or coding syntax support.
For example, .NET provide "ResourceManager Class" to help you
programmatically load resource keys from resource file or resx file. Also,
..net resource file can be embeded into assembly. If you're using custom
xml solution, you'll need to define your own xml file format and use raw
XML API to manipulate them. How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
do you know of the actual benefits of resource file instead of regular xml
First, what is the benefit of your own XML files?
The standard resources are, well, standard.
Most translation tools will know about them, some translators might know
about them, and so on.
Many people used them successfully, so it is a tried solution, working,
with some known problems and known work-arounds.
Which is probably not the case with a proprietary format.
 
thank you.

One concern i never asked was caching. currently i am caching my custom xml
files. Do resource files get cached or need caching?

If for example my application was deployed and then we found out there was a
spelling mistake, I imaging we could manually update the resource file? In
this scenario, how does caching play in?

thanks~!
 
Thanks for your followup TS,

If you're using .net resource model(resource file or embeded in assembly),
then, you should not change them frequently or dynamically at runtime.
Because when .net application running, the resource items will be loaded
into memory after it is used, just like it load the required assemblies.
Therefore, it won't let you to flexibly update and refresh it immediately
if you changed them when the application is running.

BTW, if you want to implement your own resource model and component, maybe
you can havea look at the following article which introducing extending the
.NET resource provider:

#Extending the ASP.NET 2.0 Resource-Provider Model
http://msdn2.microsoft.com/en-us/library/aa905797.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
<[email protected]>
Subject: Re: Resource file vs. regular Xml file
Date: Thu, 15 Nov 2007 08:15:57 -0600
 
steven, are resource files 1 per application or can they be split up to have
many, say 1 per 10 pages of an application. IF so is there any reason to
do/not do this?

thanks!!!!
 
Thanks for your reply TS,

For resource file, normally you will add them into project through the
following means:

** You add a resource xml file(resx file) which can contain different kind
of resource objects(string, image, file .....). So you can add multiple
such resx files in a project. When you build the project, they will be
compiled(as embeded resource) into your assembly(or separate satellite
assemlies that contains resource for specific cultures).

For these kinds of resource, you'll use API to get resource item from
it(from assembly).

#Introduction to Resources and Localization
http://msdn2.microsoft.com/en-us/library/aa309393(VS.71).aspx

#Resources in Applications
http://msdn2.microsoft.com/en-us/library/f45fce5x(vs.71).aspx


** For ASP.NET application, it has some further encapsulated functionality.
You can provide a local resource file for each aspx page or serveral global
resource files for the entire application. These resource items are easy
to reference in your aspx page(both through declarative syntax or
programatic code):

#using localization resource in ASP.NET:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/localization/localizatio
n.aspx


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
thanks steven

Steven Cheng said:
Thanks for your reply TS,

For resource file, normally you will add them into project through the
following means:

** You add a resource xml file(resx file) which can contain different kind
of resource objects(string, image, file .....). So you can add multiple
such resx files in a project. When you build the project, they will be
compiled(as embeded resource) into your assembly(or separate satellite
assemlies that contains resource for specific cultures).

For these kinds of resource, you'll use API to get resource item from
it(from assembly).

#Introduction to Resources and Localization
http://msdn2.microsoft.com/en-us/library/aa309393(VS.71).aspx

#Resources in Applications
http://msdn2.microsoft.com/en-us/library/f45fce5x(vs.71).aspx


** For ASP.NET application, it has some further encapsulated
functionality.
You can provide a local resource file for each aspx page or serveral
global
resource files for the entire application. These resource items are easy
to reference in your aspx page(both through declarative syntax or
programatic code):

#using localization resource in ASP.NET:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/localization/localizatio
n.aspx


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no
rights.
 
i see that you can add resources to a resource file at runtime. My question
is, is that persisted to the file system or only in memory in which case a
server reboot would flush?
 
Hi TS,

For the following things you mentioned:

==========
i see that you can add resources to a resource file at runtime.
=========

do you mean use "ResourceWriter" class to programmatically add resource
into existing resource file(resx or .resource...)? If so, the modification
only reflect on the resource file on disk and won't make the runtime to
automatically reload the updated resource.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: "TS" <[email protected]>
Subject: Re: Resource file vs. regular Xml file
Date: Tue, 20 Nov 2007 10:24:45 -0600
 
yes you are correct, thanks!

Steven Cheng said:
Hi TS,

For the following things you mentioned:

==========
i see that you can add resources to a resource file at runtime.
=========

do you mean use "ResourceWriter" class to programmatically add resource
into existing resource file(resx or .resource...)? If so, the modification
only reflect on the resource file on disk and won't make the runtime to
automatically reload the updated resource.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no
rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top