Page 5 of 6

Re: issue-#88 support for localizable documentation

Posted: Wed Jun 29, 2016 5:10 pm
by Josef Templ
A small fix seems to be needed in DevSearch.ThisText:
It ignores the 'source' parameter, which has been introduced in issue-#88.
Should the 'source' parameter be removed again or should it be used?
In other words: is searching in source code language dependent or not?
Since the compiler does not look up source files according to the selected language,
I think it does not give sense to do a language dependent search for sources.

So the fix would be to use the 'search' parameter instead of ignoring it.
Change the first line from

Code: Select all

	IF (Dialog.language # "") & (Dialog.language # "en") THEN
			v := Views.OldView(loc.This(Dialog.language), name)
		ELSE v := NIL
		END;
to

Code: Select all

	IF ~source & (Dialog.language # "") & (Dialog.language # "en") THEN
			v := Views.OldView(loc.This(Dialog.language), name)
		ELSE v := NIL
		END;


- Josef

Re: issue-#88 support for localizable documentation

Posted: Wed Jun 29, 2016 5:51 pm
by Josef Templ
There is even a more severe bug in DevSearch.
It still uses the CAP function for case insensitive search.
This works only for ASCII, not for Unicode.
It must use Strings.Upper().
However, this actually belongs to a different issue.

- Josef

Re: issue-#88 support for localizable documentation

Posted: Sat Jul 02, 2016 6:06 am
by Josef Templ
please comment

Re: issue-#88 support for localizable documentation

Posted: Sat Jul 02, 2016 6:20 am
by Ivan Denisov
Josef Templ wrote:is searching in source code language dependent or not?
Search in sources should not depend from language.

Re: issue-#88 support for localizable documentation

Posted: Sat Jul 09, 2016 6:31 am
by Zinn
I wonder that you did it not in the same way as the original CPC version.
There I left the procedure ThisText unchanged and add the 4 lines of language test 2 times in the procedure Search.
This way minimized the change from BB 1.6
- Helmut

Code: Select all

	PROCEDURE ThisText (loc: Files.Locator; VAR name: Files.Name): TextModels.Model;
		VAR v: Views.View; m: Models.Model;
	BEGIN
		v := Views.OldView(loc, name);
		IF v # NIL THEN
			m := v.ThisModel();
			IF m # NIL THEN
				WITH m: TextModels.Model DO RETURN m ELSE END
			END
		END;
		RETURN NIL
	END ThisText;

Code: Select all

			w.ConnectTo(log); w.SetPos(0);
			IF source THEN loc := Files.dir.This("Mod"); path := "Mod"
			ELSE loc := Files.dir.This("Docu"); path := "Docu";
				IF (Dialog.language # "") & (Dialog.language # "en") THEN
					loc := loc.This(Dialog.language);
					path := path + "/" + Dialog.language
				END
			END;

Code: Select all

				loc := Files.dir.This(dirs.name); path := dirs.name + "/";
				IF source THEN loc := loc.This("Mod"); path := path + "Mod"
				ELSE loc := loc.This("Docu"); path := path +"Docu";
					IF (Dialog.language # "") & (Dialog.language # "en") THEN
						loc := loc.This(Dialog.language);
						path := path + "/" + Dialog.language
					END
				END;

Re: issue-#88 support for localizable documentation

Posted: Sat Jul 09, 2016 4:44 pm
by Josef Templ
Helmut, I think it was done in this way for keeping the changes of Search to a minimum.
Now we have only an additional parameter passed to ThisText when compared to BB1.6
Search is already a very long procedure and it is better to avoid any code
replication inside Search since this would make it even longer and more complicated.
ThisText, on the other hand, is still short and easy to comprehend and it avoids any code
replication.

- Josef

Re: issue-#88 support for localizable documentation

Posted: Sun Jul 10, 2016 9:35 am
by Josef Templ
My proposal for the changes are in the branch issue-#88.
For the changes see http://redmine.blackboxframework.org/pr ... 2db74b3ae8.

It has been aligned with the coding style in StdApi, where the parameter named useLang is used for that purpose.

- Josef

Re: issue-#88 support for localizable documentation

Posted: Tue Jul 12, 2016 10:06 am
by Josef Templ
can we proceed with this? I think yes.

Re: issue-#88 support for localizable documentation

Posted: Wed Jul 13, 2016 1:26 am
by DGDanforth
Josef Templ wrote:My proposal for the changes are in the branch issue-#88.
For the changes see http://redmine.blackboxframework.org/pr ... 2db74b3ae8.

It has been aligned with the coding style in StdApi, where the parameter named useLang is used for that purpose.

- Josef

Code: Select all

  PROCEDURE ThisText (loc: Files.Locator; VAR name: Files.Name; source: BOOLEAN): TextModels.Model;

  PROCEDURE ThisText (loc: Files.Locator; VAR name: Files.Name; useLang: BOOLEAN): TextModels.Model;

Which seems to replace "source" with "useLang" and yet later in the comparison "source" is still used (as "~source").
Its not clear to me what has or has not been replaced.
-Doug

Re: issue-#88 support for localizable documentation

Posted: Thu Jul 14, 2016 5:23 pm
by Josef Templ
'ThisText' is not concerned with the distinction between source or docu or whatever kind of file.
It only needs to know if it should look at a language subdirectory.
Therefore it uses a parameter named useLang in the same way as it is done in StdApi.

'Search' on the other hand is called for two kinds of files, for sources and for docu.
Therefore it has a parameter named source and if set it uses Mod otherwise it uses Docu.
This has not been changed and it doesn't give much sense to change that.

- Josef