--- a/ResourcePack.st Sat Nov 13 11:35:40 2010 +0100
+++ b/ResourcePack.st Sat Nov 13 11:42:05 2010 +0100
@@ -85,20 +85,30 @@
so using percent-placeholders is much better than simple concatenations of
arguments to the question.
- More languages can be added later without any change in the code,
- recompilation or the like.
- Even by people without access to the source code i.e. which only have the
- applications binary.
+ More languages can be added later without any change in the code, or recompilation
+ or the like. Even by people without access to the source code (i.e. which only have the
+ applications binary).
Also, unsupported languages' strings are simply left unchanged - if you
write your application in (say) english, and only plan to use it in english,
- no additional work is required (i.e you dont need a resource file then).
+ no additional work is required (i.e you don't even need a resource file then).
Strings for unknown languages will come in english
(which is better than nothing or empty button labels ;-)
+ Notice, that you can also translate engish to english, by providing an en.rs file.
+ This is sometimes useful to fix typing errors or bad syntax in the english,
+ as sometimes made by the programmer, without a need to recompile or to also adjust other
+ language translations.
+
+ Finally, this scheme is also compatible to a pure enum-key based translation mechanism,
+ as typically used in the C-world.
+ Simple use keys as argument, and provide translations for all languages (incl. english).
+ For example:
+ Button label:(resources string:#BTN_FOO_LABEL)
+
+
Summary:
- in subclasses of View and ApplicationModel,
- instead of writing:
+ in subclasses of View and ApplicationModel, instead of writing:
...
b := Button label:'press me'
@@ -111,12 +121,14 @@
...
if your class is not a subclass of one of the above, AND you need
- resource translations, you wont inherit the resources variable
+ resource translations, you won't inherit the resources variable
(which is automatically initialized).
In this case, you have to ask the ResourcePack class explicitely for
a corresponding package:
ResourcePack for:aClassName
+ or (even better):
+ ResourcePack forPackage:aPackageID
as an example, see how the Date class gets the national names of
week & monthnames.
@@ -1378,11 +1390,11 @@
!ResourcePack class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.147 2010-11-13 10:35:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.148 2010-11-13 10:42:05 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.147 2010-11-13 10:35:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.148 2010-11-13 10:42:05 cg Exp $'
! !
ResourcePack initialize!