Menus files and multiple languages support

Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Menus files and multiple languages support

Post by Zinn »

A menus file e.g looks like

MENU "File"
"&New" "N" "StdCmds.New" ""
"&Open..." "O" "HostCmds.Open" ""

and so on ...
But using it for language translation via Strings the "#Subsystem:" name is missing, e.g.

MENU "#System:&File"
"#System:&New" "N" "StdCmds.New" ""
"#System:&Open..." "O" "HostCmds.Open" ""

I won't add the "#Subsystem:" name in front of every menu entries, because the menu file is more readable without.
The questions are:
Should I insert in module HostMenus (4 times) a default subsystem name like

IF menu[0] = '#' THEN Dialog.MapString(menu, curMenu.menu)
ELSE Dialog.MapString("#System:"+menu, curMenu.menu)
END;

Which subsystem name should I use? System, Host or another subsystem?
Or should I insert the default Subsystem Name in Dialog.MapString directly?
The same questions arise with Forms.
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Menus files and multiple languages support

Post by DGDanforth »

Zinn wrote:A menus file e.g looks like

MENU "File"
"&New" "N" "StdCmds.New" ""
"&Open..." "O" "HostCmds.Open" ""

and so on ...
But using it for language translation via Strings the "#Subsystem:" name is missing, e.g.

MENU "#System:&File"
"#System:&New" "N" "StdCmds.New" ""
"#System:&Open..." "O" "HostCmds.Open" ""

I won't add the "#Subsystem:" name in front of every menu entries, because the menu file is more readable without.
The questions are:
Should I insert in module HostMenus (4 times) a default subsystem name like

IF menu[0] = '#' THEN Dialog.MapString(menu, curMenu.menu)
ELSE Dialog.MapString("#System:"+menu, curMenu.menu)
END;

Which subsystem name should I use? System, Host or another subsystem?
Or should I insert the default Subsystem Name in Dialog.MapString directly?
The same questions arise with Forms.
Wait! Isn't the intent of a menu name,e.g. "File" simply to label a menu? I don't think it should have any connection to a directory or subsystem.
I think the issue you are addressing is how to have that label translated into the desired language for a user.
Am I off base here? What are you actually trying to do?
-Doug
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: Menus files and multiple languages support

Post by Zinn »

The language translation via Strings file (e.g. File TABULATOR Datei) does not work without the subsystem label !!!!!!!!!!!
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Menus files and multiple languages support

Post by Ivan Denisov »

Zinn wrote:The language translation via Strings file (e.g. File TABULATOR Datei) does not work without the subsystem label !!!!!!!!!!!
Helmut, I have solution in my edition of BlackBox.
http://gitlab.molpit.com/molpit/blackbo ... rchive.zip

I used special tag for tabulation [tab] instead of 9X char.
"#System:&Delete [tab] Delete" "" "StdCmds.Clear" "HostCmds.CutGuard"
AND modified System/Mod/Dialog.odc

Code: Select all

	PROCEDURE MapString* (in: ARRAY OF CHAR; OUT out: ARRAY OF CHAR);
		VAR len, k: INTEGER;
	BEGIN
		SearchString(in, out);
		IF out = "" THEN
			k := 0; len := LEN(out)-1;
			WHILE (k < len) & (in[k] # 0X) DO out[k] := in[k]; INC(k) END;
			out[k] := 0X
		END;
		Strings.Find(out, " [tab] ", 0, k); (* hack for tabs in CpcLanguages *)
		IF k > 0 THEN Strings.Replace(out, k, 7, 9X) END
	END MapString;
All works well now.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Menus files and multiple languages support

Post by Josef Templ »

Zinn wrote: I won't add the "#Subsystem:" name in front of every menu entries, because the menu file is more readable without.
The questions are:
Should I insert in module HostMenus (4 times) a default subsystem name like

IF menu[0] = '#' THEN Dialog.MapString(menu, curMenu.menu)
ELSE Dialog.MapString("#System:"+menu, curMenu.menu)
END;

Which subsystem name should I use? System, Host or another subsystem?
Or should I insert the default Subsystem Name in Dialog.MapString directly?
The same questions arise with Forms.
A menu or menu item that is unmapped must not look the same as a menu or menu item that is mapped!
It is not 100% compatible with existing programs if a mapping is introduced at a place where there was no mapping before.
Note that this implicit mapping does not only apply to standard BlackBox menus but to all user created menus as well.
There may be just by accident a mapping in a Strings file. That mapping would then be used unintentionally.

Note also that the keyboard shortcut key may also require a mapping.

If a mapping is to be used, it must be clearly specified by using the mapping notation.
The only short-hand notation I could imagine is to reuse the most recently specified subsystem name
as the default for a menu item if no subsystem name is given as in "#:xxx", where 'most recently' refers to the
textual order, i.e. left to right and top to bottom. This, however, has the drawback that reordering menu items
is not as easy as with a context free approach.

Putting the & character into the mapping key of a non_existing mapping as in "#System:&New" is really a dirty hack.
It makes translation of Strings files much more difficult because it is not explicitly visible
in the default language's Strings file which keys to put into the translation.
The clean approach would be to use "#System:New" as the key and to provide a mapping that returns "&New".

- Josef
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: Menus files and multiple languages support

Post by Zinn »

Thank you for your fair comments. Now I’m sure that adding a default subsystem name is not a good idea. I will add Iwan’s patch and Josef’s clean approach to the CPC edition.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Menus files and multiple languages support

Post by Josef Templ »

I don't understand Ivan's patch.
What is the 'tabulation' used for?
Can somebody please explain it.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Menus files and multiple languages support

Post by Ivan Denisov »

Tabulation is multifunctional. In Strings.odc it used for dividing columns. In menus it used for dividing default system hotkeys. This led to the problem during transtaltion, because menus items should be stored in two columns.
tab_patch.png
tab_patch.png (18.22 KiB) Viewed 19311 times
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Menus files and multiple languages support

Post by DGDanforth »

This discussion is leading toward an ill defined conclusion.
The goal of being able to translate menus and forms into other languages
using the Strings file mechanism raises serious questions.

Who maintains the Strings file? Is it the creator of the Menus and Forms or is it
by the users of those menus and forms?

If the developer is responsible for maintaining the Strings file (the translations) then
how many languages must the developer support? If it is the user that creates a translation
into their preferred language then that is a detriment to the distribution of software for
each project distributed needs to be translated into each language desired.

What about .osf files? Shouldn't they also be translated?

Ideally one would want an automated system that when one downloads a file (such as
those at CPC) the text would automatically be translated into the default language of the user.
Of course reserved words of CP would not be translated (or should they, i.e. should the compiler
be language independent?). But now an automatic translation process such at Google Translate
is error prone. It might not convey the desired translation that a hand produced Strings file would
generate. But then again documentation translation can not be handled via a Strings file. That translation
truly is natural language.

So I now see the issues of Characters/UTF-8, Menus and Forms as stepping into the murky waters of
natural language. That is driven by our desire to encompass a multilingual user group.

Can we find a clean stopping point without embracing natural language?

-Doug
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Menus files and multiple languages support

Post by Ivan Denisov »

I think that we can include CpcLanguages in Center version. We can add language select menu in properties. During first start the language will be choosen by default system language. IMHO, this is important for making blackbox more popular.
Attachments
lang.png
lang.png (2.79 KiB) Viewed 19297 times
Post Reply