Wah On Terra .NET: Martin Granell's Blog

Attacking the scary bits in .NET

Home Contact Syndicate this Site (RSS 2.0) Syndicate this Site (Atom) Login
  29 Posts :: 0 Stories :: 68 Comments :: 3210 Trackbacks

Archives

Post Categories

Readify Blogs


Wednesday, February 09, 2005 #

This post and comments can now be found on my new blog here

UPDATE: There was a problem in the previous release. Method (b) would not work (thanks to VS.NET for not handling satellite assemblies correctly..). I've updated the instructions below, and the sample in the release, to cover what needs to be done to make it work:

Hi Folks,

The next release (1.2.2 1.2.3) of the string resource tool is here… Changes for this release are:

1.       More complete sample, that should cover all of the functionality of the Custom tool and Batch .exe

2.       Accessibilty option now works (with VB.NET & C# only at this point, otherwise it can only be public, blame CodeDom).

3.       The Resource class generation can be turned off by using “generate_class = false”

4.       SR.strings files can now contain multi-line resources, by doing the following:

[strings]
ResName(int age) = First Line
= Second Line {0}
= Third Line
NextRes = Blah

5.       From release 1.2.1 onwards its possible to use 3 methods of having multiple locales resources in the same project.
(a) Have a primary .resx file (e.g. SR.resx), with the CustomTool option set. Have secondary .resx files (e.g. SR.de.resx, SR.en.us.resx), which do not have a custom tool set.

b) Have a primary SR.strings file, with one [strings] section with all the neutral resources, with the CustomTool set. Have secondary .strings files (e.g. SR.strings-de) _with_ the Custom Tool set, but with “#! generate_class = false” at the beginning of all the secondary .strings files, and locale dependent [strings] sections, e.g:

SR.strings:
[strings]
ResName = blah

SR.strings-de:
#! generate_class = false
[strings.de]
ResName = German blah

SR.strings-de-DE:
#! generate_class = false
[strings.de-DE]
ResName = German in Germany blah

Note: The extension on the secondary strings files can be anything, but the base filename must be the non-localized resource name. i.e. SR.de.strings is not valid because the base name is “SR.de“. SR.strings-de is valid, because the base name is “SR“.

c) Multi-locale .strings file. Have a SR.strings file with multiple [strings] sections, one for each locale. e.g.
[strings]
Res1 = Text
...

[strings.de]
Res1 = German Override
...

[strings.de.DE]
Res1 = Germany override
...



Note that you can combine all of these options if you wish. E.g. a primary SR.strings file with:
[strings]
[strings.en]
[strings.en.US]

And a secondary SR.strings-de file with:
#! generate_class = false
[strings.de-DE]
[strings.de-CZ]

which will generate:
SR.de-DE.resx
SR.de-CZ.resx
 

posted @ 10:33 PM