People who would like to develop and market applications in non English speaking countries have to use standard development tools, with one file per resource type and supported language (or a directory per supported language).
Applications written in BASIC can benefit from the code fragment named ResFind (written by Olaf Krumnow and Herbert zur Hedden from the German Archimedes Group).
Applications written in C can benefit from the SetRes program (I wrote) for all Toolbox based Wimp applications (or else refer to the Local article for applications still using RISCOSlib).
Interactive help allows client applications, as they submit text messages to display in !Help application's window, to specify tokens which will be then translated by the !Help application into readable sentences (after having read an internal dictionary).
This shortens the data (and then help to put more text in a single Wimp message).
Every token is prefixed in the transmitted data by the backslash character (\) which acts as an escape character. Following this prefix is a single character (code is greater than space) specifying the pattern for the !Help application to use when reading from the dictionary.
You can find samples of such messages by viewing message files in the Resources:$.Resources hierarchy. Navigate to the subdirectories associated with classic Acorn desktop applications (such as !Alarm).
Unfortunately, only translating the Messages file within the Help resource directory can only solve the problem provided that every installed application or system component on the user computer speak the same language. At most times, this should be English because:
Messages
files);
DEFPROCe:LOCALx%,T%,M%,A%,p%,m%,N%,I%,y%,oa%: \ SYS39,a%+20,n%,512+(1<<31)TOp%,,A%:A%+=n%:?A%=13:p%?-1=13:t$=$(a%+20):IFt$=c$ENDPROC c$=t$:y%=J%:FORx%=n%TOA%:?y%=?x%:IF?x%<>ASC("\")THEN y%+=1 ELSE:x%+=1:IF?x%=ASC("\")THEN y%+=1 ELSE:$(y%)=FNa("T"+CHR$(?x%)):IF?y%=ASC("T")AND?(y%+1)=?x%ANDLEN($(y%))=2THEN?y%=ASC("\") y%+=LEN($(y%)) ENDIF ENDIFAnd now, the patched version which uses an additional local string variable z$ (holding the first letter from the token to be used as a key when reading the token definition from the dictionary):
DEF PROCe:LOCAL x%,T%,M%,A%,p%,m%,N%,I%,y%,oa%,z$: \ SYS39,a%+20,n%,512+(1<<31)TOp%,,A%:A%+=n%:?A%=13:p%?-1=13:t$=$(a%+20):IF t$=c$ENDPROC c$=t$:y%=J%:FOR x%=n%TOA%:?y%=?x%:IF?x%<>ASC("\")THEN y%+=1 ELSE:x%+=1:IF?x%=ASC("\")THENx%+=1:z$="U"ELSEz$="T" $(y%)=FNa(z$+CHR$(?x%)):IF?y%=ASC(z$)AND?(y%+1)=?x%ANDLEN($(y%))=2THEN?y%=ASC("\") y%+=LEN($(y%)) ENDIF
DEF PROCt:LOCAL F%,M$:M$="Help:<Boot$OSVersion>" DIM e%256:SYS30,6,,,17+LEN(M$)TO,,t%:$(t%+16)=M$:SYS398592,,t%+16TO;F% IF F%AND1THEN$(t%+16)="Help:Messages" SYS267521,t%,t%+16,0:ENDPROC
Config.s.ConfigMain
; Help.s.ConfigMain
and Kernel.s.AString
source code files.
The second update involves changes to Help.s.HelpExpand
source code files.
Help$Path
environment variable setting!Run
file of the !Help application. As !Help is a BASIC application, the use of ResFind comes to mind.
Below is the original !Run file content (stored in the Resources:$.Apps.!Help
directory):
| > !Run | Check for the required amount of memory first WimpSlot -min 32K -max 32K | Having succeeded there, do not start up if | Help is already running. If "<Help$Dir>"<>"" Then Error Help is already running | Then start the application Set Help$Dir <Obey$Dir> Set Help$Path <Obey$Dir>.,Resources:$.Resources.Help. Run Help:!RunLinkAnd now the new !Run file (a modified version can be found in the archive, to be used if the application should be started from within the Apps icon on the iconbar, the RISC OS command AddApp was used to place this icon during the boot sequence).
| > !Run | Check for the required amount of memory first WimpSlot -min 32K -max 32K | Having succeeded there, do not start up if Help is already running. If "<Help$Dir>"<>"" Then Error Help is already running | Then start the application Run <Obey$Dir>.Resources.ResFind Unset HelpRes$Path Unset Help$Dir If "<HelpRes$Dir>"="<Obey$Dir>" Then /Resources:$.Apps.!Help Set Help$Path <HelpRes$Dir>.,Resources:$.Resources.Help. Unset HelpRes$Dir Set Help$Dir Resources:$.Apps.!Help Run <Obey$Dir>.!RunImage
<AppNameR$Dir>
) according to the current setting of another environment variable ("<AppName>
") and to the country currently set (which value can be read/written with the Country RISC OS command).toolbox_initialize
API is that it requires that the pathname given for it to search the res
and Messages
files must not be a pseudo FS specifier (like AppNameR: which use the setting of the AppNameR$Path
environment variable).
To work around this glitch, we have to duplicate the Messages
file in both directories.
The choice of one file from the list above is based on the criteria below:
The first detection to perform is to determine the "default" interactive help application (either Acorn !Help or !BubbleHlp) according to the value of the Help$Start
system variable.
"<BubbleHelp$Dir>"
(macro expansion no withstanding), then !BubbleHlp is the default application; the program then tries to find an answer to each query below:
BubbleHelpTokens$Path
system variable exist?
BubbleHelpTokens:CountryName
directory exist?
<AppNameR$Dir>.nhelp.res
will be selected only if all answers to the above queries are yes.
Help$Path
system variable exist?
Help:!RunImage
ResourcesFS?
Help$Dir
exist? If yes, this implies that the !Help application is active.
<AppNameR$Dir>.nhelp.res
will be selected only if all predicates below are true:
Help$Path
environment variable exists;
Help:!RunImage
is not supported by the ResourceFS file system (cf the short BASIC program Resources:$.Resources.Help.RunLink
);
res
and Messages
;
.nhelp
directory.
ResFind
) and is included in the archive. This program takes the current value of the <AppName>R$Dir
variable, and output a modified value for it according to the predicate evaluation described above.
AppNameRes$Path
system variable being set as a result of the call to the module above, and preprends it (or leave it unchanged) with the adhoc directory to take into account a new "Messages" file holding tokenized text for returning to the IH application. The same rules as above apply for selecting the right resources res
file.
<AppNameRes$Dir>.nhelp.Messages
instead of <AppNameRes$Dir>.Messages
.
Sample applications which have been updated this way to make them compliant with NIH are the latest release of !Player from ESP and my own localisation initiative of !StrongED (4.62) you can find on this Web site too.
U
' which means that the localized token set will be used (eg. extract from the !Help:Messages
in my RISC PC with NIH installed: US:Cliquez SELECT pour
). However, if you want to deal with original message files, you can specify the original token set by setting this parameter to the value 'T
' (eg. another extract from the !Help:Messages
in my RISC PC: TS:Click SELECT to
).
#
' sign serves other purpose than marking a commented section begin. This is the 'raison d'être' of the 'Process commented segments
' option which lets the tool consider the '#
' character as a normal character.
\\
' which is adequate for dealing with NIH Messages files, however, you might need to deal with the original escape sequence ('\
') just to ensure that you fully benefit from the compression facility provided by the IH dictionary system (in terms of disc/memory footprint).
'-p'
) exists to specify lines which are due to be processed and lines which sould be kept unchanged. If the option includes a string parameter (in GSTrans format), then only those lines which begin with that string will be converted.
NIHTool -p Hicon ...
will process only lines from the source file which begin with the Hicon
string pattern.