issue-#88 support for localizable documentation

Merged to the master branch
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#88 support for localizable documentation

Post by Robert »

Zinn wrote:I didn't notice that discussion. We should ask for Robert's solution and define an interface for this topic. The deletion of directory and files is missing in Robert's description.
- Helmut
The listing below contains 4 files - 2 Modules with Mod and Docu files.

The first Module is essentially 3 lines long, it contains the interfaces to 3 procedures in the Shlwapi dll ("Light-weight shell API ?). Shlwapi probably contains hundreds more functions.

The second module puts five "Wrappers" around them as listed in my forum post.


To use this approch to implement a "FileExists" function one would write something like:

Code: Select all

MODULE  CasketShlwapiDll ["shlwapi.dll"];
IMPORT  SYSTEM, Win := WinApi;

PROCEDURE  PathFileExistsW* (path : Win.PtrWSTR) : Win.BOOL;
PROCEDURE  PathIsDirectoryW* (path : Win.PtrWSTR) : Win.BOOL;
END  CasketShlwapiDll.

(*  ---  New  Module  ---  *)
PROCEDURE  FileExists* (IN pathName : ARRAY OF CHAR) : BOOLEAN;
  BEGIN
    RETURN (CasketShlwapi.PathFileExistsW(pathName) # WinApi.FALSE) & (CasketShlwapi.PathIsDirectoryW(pathName) = WinApi.FALSE)
  END  FileExists;
This approach works using strings rather than Locators.

I have concerns about Josef's proposed FileExists function. The BlackBox documentation does not say what happens when you ask for a Locator to a non-existant path. If you get loc = NIL the proposed code would fail.

Experiments seem to indicate that loc = NIL never happens. Can we rely on this? Why can we rely on this?

If it never happens are routines like StdDialog.GetSubLoc correct, as it tests for loc = NIL?


If we do implement a FileExists function I think it could be generally useful, so should be exported and documented.


Regards & Seasons Greetings to all.

Code: Select all

PacCoder.Decode /I:.Pk/h.5..:k....3fz/EUE/.6Uk0I5hz.Y.5.BiUKidTk3MuM2VxMBsiS
.oy8UP6Q84HNH.49:VEiEpqt2er:e0t0cOJ0e4nw1gJM6zyL0:uz09DOwa8utB0iFft5XYYyFVqQ
7Krt70BlT9gWYYcFO6JnfQ2wPjizBRzjocFVWPe54c1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Uit5nEhb
nCIDvz27y8uTIdqmaJXrh5UqKiCJYHflt2SHPeGRodvMzBrfSYRihKhupDuxVHFLIGTGHiVcQPyv
oNi:vznf:Z8pjIl53gMDIrxUQequ:uDjmne7VWwhtr9RM8:TPzoXLbjj9ib/zeH0pybZJdkYVNNQ
glkTXizWJWWTrxvmR6zc9mHjyBNmkCjOC6hLhCavwB5Hq7t9fd:ndRToKP8tzy6BTe9YcR7PTg5G
TndJGkh6zl1QCfCiyuQtxx5JgSglaVrjDizTTRyaq3o7jIfEYwypVSgi0oRhR1zTvwWXeQyI5zfD
tzjr0Btbny6wO7fh4TLHOQ26xzayCUHj3o2EebW2ER8LCuzRRiQVR9fsUlYJfyr2TYltNvRKI0vR
DjoQPDttJiFfoRKbFjynFfD:spiGZihnwzCIFCKbeNjqdzIQzFjMCpgBVIp:mYXTpOHaoVfSYhOH
bmq4hBgCRjD5SrrwZ7LsPhhDhy6GOGqctG7m3SrucXQH8TTObl.vTS3SXyhSubugzcPdheqipiV0
bWc.29Ejt4UJ4meBI9Ki34u3CYZNq0QrdyBLQPtbuVSKxF4P4LG4B:GOYq3bVuHqtDzIbjwCyVys
P2NPTXgjCCChu7rFjDvxHR0eiLqPMLf935yhTExOBFZemto3HwJyknKpuBzmrCJZ4zMdMhuksGmj
:ft25zjalajRlnMZ/oMbyrHtaDPLCSHiLIdMPFNxW6cR7f6byThLwFlNjEi8Y8hfItzOyvibCvxx
kTMSLVr6DwMUDZ46KbdY7pCtbNhTbyRa9xUfXemqOqyidk/KU60oy.
AtEndOfEncoding
Last edited by Robert on Tue Dec 29, 2015 1:43 pm, edited 2 times in total.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#88 support for localizable documentation

Post by Josef Templ »

Thanks for the hint. Tour.odc has been moved to Docu.
For the changes see:
http://redmine.blackboxframework.org/pr ... bc67b413dd.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#88 support for localizable documentation

Post by Robert »

1 - I have updated my "FileExists" suggestion to make it easier to read; it is more self-contained.
It is also untested as posted, but I have tested and use very similar code myself.

2 - I agree with Josef that we need to separate the questions: "What should be done?" & "How to do it?".

As far as I can tell even the first question has not been answered and agreed yet. If it has the answer wants to be explained more clearly.

Let me give an example: Suppose we have two documents I shall call "Map" & "Manual", and there is a link in Map to Manual.

Taking Peruvian as an example we need to consider all combinations of the cases:

a): The Peruvian version of Map exists
b): The Peruvian version of Manual exists
c): The language preference is set to Peruvian
d): The user wants to open the default (English) version of the document.

Regarding the user choices the "How" question has two aspects: "How does the user select the desired behaviour?", and "How is BlackBox coded to make it happen?".
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#88 support for localizable documentation

Post by Josef Templ »

Robert wrote: Let me give an example: Suppose we have two documents I shall call "Map" & "Manual", and there is a link in Map to Manual.

Taking Peruvian as an example we need to consider all combinations of the cases:

a): The Peruvian version of Map exists
b): The Peruvian version of Manual exists
c): The language preference is set to Peruvian
d): The user wants to open the default (English) version of the document.

Regarding the user choices the "How" question has two aspects: "How does the user select the desired behaviour?", and "How is BlackBox coded to make it happen?".
The latest solution has the following behavior:
If the language preference is set to Peruvian and the Peruvian version of Manual exists and the Manual is referenced from Map by means of StdCmds.OpenBrowser("Docu/Manual", "Manual") the peruvian version would be opened.
If you want to browse the english version you would have to set the language preference to 'en'.
The english version would also be opened if it is referenced as StdCmds.OpenBrowser("Docu/en/Manual", "Manual")
but in practice, I guess, this will not be used much.
With File->Open... you can always open the version that you have selected in the Windows control.

I have noticed another problem:
The window title should also be localized to the Peruvian version of Manual.
Currently it is not. It would either require
StdCmds.OpenBrowser("Docu/Manual", "xxx"), i.e. hard coded in the peruvian Map file, or
StdCmds.OpenBrowser("Docu/Manual", "#System:Manual"), i.e. mapped via a Strings resource.
The latter option would require us to change ALL links to docu files, so we probably have to go with
hard coding it when localizing a docu file.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#88 support for localizable documentation

Post by Robert »

Josef Templ wrote:I have noticed another problem:
The window title should also be localized to the Peruvian version of Manual.
Currently it is not. It would either require
StdCmds.OpenBrowser("Docu/Manual", "xxx"), i.e. hard coded in the peruvian Map file, or
Two problems ?
1 - What if Peruvian Map does not exist but Peruvian Manual does; it would not get a Peruvian title.
2 - What if Peruvian Map does exist but Peruvian Manual does not; should an English Manual get a Peruvian title?
StdCmds.OpenBrowser("Docu/Manual", "#System:Manual"), i.e. mapped via a Strings resource.
The latter option would require us to change ALL links to docu files, so we probably have to go with
hard coding it when localizing a docu file.
Is it that difficult to write a (short) Command to scan and modify all these links automatically? Who is good with regular expressions?
I would be prepared to try to write such a Command if it was felt to be desirable, but:
1- Would it be safe? Probably not too big a worry as we would have backups.
2 - Updating the links is one thing, but updating the change databases is another!
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#88 support for localizable documentation

Post by Josef Templ »

With hard coding the localized title in a localized docu file you would get the same language for the window title
and for the link name, which is a nice and intuitive invariant.
e.g.
<StdCmds.OpenBrowser('Docu/Tour', 'Guided Tour')>Guided Tour<>
<StdCmds.OpenBrowser('Docu/Tour', 'Peruvian Guided Tour')>Peruvian Guided Tour<>

I think it is not possible to improve the situation for partially translated docu, and it is not required.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#88 support for localizable documentation

Post by Josef Templ »

As far as I see this issue is ready for voting.

With the current state it is possible to localize the docu
and it is also possible to localize only a part of it and the references
between the default language and the localized part work well.

The changes are kept to a minimum and only with a first real localization attempt
we will see if there are any unexpected problems.

We should not block the remaining open issues but proceed more quickly.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#88 support for localizable documentation

Post by Josef Templ »

A Wiki page has been added for localization of BlackBox, see
http://wiki.blackboxframework.org/index ... g_BlackBox

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

Re: issue-#88 support for localizable documentation

Post by Zinn »

Is it allowed to have a document in the language directory "Docu/xx/" which does not exist in directory "Docu/"?

If the answer is yes then we have a "Search in Docu" problem.
The contents of this document will not be found.

- Helmut
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#88 support for localizable documentation

Post by Josef Templ »

The assumption is that there must always be a file in the standard docu dir
before creating a file in a special language dir and the file names for translated files
must be the same as for the standard language file.

- Josef
Post Reply