rejetto forum

Software => HFS ~ HTTP File Server => Beta => Topic started by: FRENCH CAN CAN on March 20, 2011, 11:34:53 PM

Title: [special:import] translation
Post by: FRENCH CAN CAN on March 20, 2011, 11:34:53 PM
- {.!text.} was not working in [special:import]

it works now? does not appear.  ???
Title: [special:import] translation
Post by: Mars on March 21, 2011, 02:44:05 PM
- {.!text.} was not working in [special:import]

it works now? does not appear.  ???

work for me with build 276
Quote
[special:import]
{.add to log| hello {.!mars|FRENCH CAN CAN.}
:D
Do not forget that special:import is executed only once and only when you change the template:
private template --> restore default -->private template

Title: [special:import] translation
Post by: FRENCH CAN CAN on March 21, 2011, 07:05:24 PM
[+special:strings]

Italian = it

English = en

Automatic = auto



language=it



[+special:import]


{.dialog| {.if|{.{.!language.}=it.}|

mars language Italian .}.}


{.dialog| {.if|{.{.!language.}=en.}|

mars language English .}.}


---------------------------------------------------------------------------------------------


In this way does not work for me is a bug.
Title: [special:import] translation
Post by: Mars on March 21, 2011, 08:43:26 PM
It works as it is, no particular problem, it is necessary to make sure that all the sections begin with one [+...], and to empty the cache of hfs, it is necessary for that to restart hfs.

It is necessary to watch not to put spaces at the level of strings, because they are included in the transcription

[+special:strings]

Italian=it

English=en

Automatic=auto



language=it
Title: [special:import] translation
Post by: FRENCH CAN CAN on March 21, 2011, 11:53:08 PM
The command to the macro is this:

[+special:strings]

language=it


these guys have nothing to do:

Italian = it

English = en

Automatic = auto
Title: [special:import] translation
Post by: rejetto on March 22, 2011, 01:32:55 PM
if i copy and paste the text you say in a file "test.tpl", then drag&drop this file over hfs, it asks for "installing", i say yes, then i get this dialog

---------------------------
HFS 2.3 beta (276)
---------------------------
mars language Italian
---------------------------
OK   
---------------------------



That's what i expect to get. Don't you get the same?
Title: [special:import] translation
Post by: Mars on March 22, 2011, 06:23:13 PM
if i copy and paste the text you say in a file "test.tpl", then drag&drop this file over hfs, it asks for "installing", i say yes, then i get this dialog

---------------------------
HFS 2.3 beta (276)
---------------------------
mars language Italian
---------------------------
OK  
---------------------------

That's what i expect to get. Don't you get the same?

yes rejetto this is working but edit the template test.tpl by replacing language=it by language=en ,then drag&drop this file over hfs, it asks for "installing", i say yes, then i get this dialog

---------------------------
HFS 2.3 beta (276)
---------------------------
mars language Italian                     <<-- and not English, special:strings is not cleared on new tpl :-\
---------------------------
OK  
---------------------------


second bug; mars is french , not italian or english :D ;D ;)
Title: [special:import] translation
Post by: FRENCH CAN CAN on March 22, 2011, 06:44:26 PM
I enclose here below the TPL with the problem to be solved:

Allego sotto qui il TPL con il problema da risolvere:
Title: [special:import] translation
Post by: FRENCH CAN CAN on March 22, 2011, 07:03:58 PM
second bug; mars is french , not italian or english :D ;D ;)

The second bug can not be solved, mars should change nationality and become Italian (it worsens his life). :D ;D 8)

Il secondo bug non si può risolvere, mars dovrebbe cambiare nazionalità e diventare Italiano (ma peggiora la sua vita). :D ;D 8)
Title: [special:import] translation
Post by: Mars on March 22, 2011, 07:44:33 PM
@french

{.and|{.{.!language.}=auto.}{.{.!language.}=it.}|{.not|{.{.!language.}=en.}.}

cannot work

same as

 ( color=blue & color=red & not color= green)  ;D

simply put
{.dialog|{.{.!language.}=it.}|

Grazie ...

and same to english dialog
 ;)
Title: Re: [special:import] translation
Post by: rejetto on March 23, 2011, 02:22:40 PM
@mars
it can work, i think
you should read it as
auto OR it AND NOT en

because when you have 2 tests attached, it behaves as an OR, because the 0/1 is joined to another 0/1 and the result is 00/01/10/11 (where only 00 is considered false, because is a numeric zero).

@french
you should use debug > enable macros.log
is a very useful feature to understand what's goin' on.
and i just saw where your problem is
when {.!language.} is evaluated, the result is

    en (N.B.: Impostato in questo modo si dovrebbe visualizzare il SOLO messaggio in lingua Inglese ma non funziona.)


and it's right by HFS, the bug is yours ;)
Title: Re: [special:import] translation
Post by: rejetto on March 23, 2011, 02:30:16 PM
as an additional suggestion
instead of having many {.dialog.} go for

{.dialog|{.switch|{.!language.}|
  | it | Ciao, così è molto meglio, non credi?
  | Hello! this is the default choice, if "language" is different from all of the above cases
.}.}
Title: Re: [special:import] translation
Post by: FRENCH CAN CAN on March 23, 2011, 08:06:37 PM
@french
you should use debug > enable macros.log
is a very useful feature to understand what's goin' on.
and i just saw where your problem is
when {.!language.} is evaluated, the result is

    en (N.B.: Impostato in questo modo si dovrebbe visualizzare il SOLO messaggio in lingua Inglese ma non funziona.)

rejetto ho già fatto la prova "debug > enable macros.log", ma penso che non funziona.

rejetto I did the test "debug> enable macros.log," but I think it does not work.


Quote
and it's right by HFS, the bug is yours ;)
a me sembra un bug di hfs, vedi il tpl allegato sotto. 8)

it seems to me a bug in HFS, see the tpl attached below. 8)
Title: Re: [special:import] translation
Post by: Mars on March 23, 2011, 11:54:12 PM
@rejetto, there is realy a bug, i found the solution ;)

classeslib.pas

Quote
procedure Ttpl.fromString(txt:string);
begin
freeAndNIL(strTable);  // add by mars 23/03/2011  necessary when loading modified tpl
src:='';
sections:=NIL;
fileExts:=NIL;
last.section:=#255'null'; // '' is a valid (and often used) section name. This is a better null value.
appendString(txt);
end; // fromString

Quote
function TcachedTpls.getTplFor(fn:string):Ttpl; //update mars 23/03/2011  removed tests about crc and size of file
var
  i: integer;
  o: TcachedTplObj;
  s: string;
begin
fn:=trim(lowercase(fn));
i:=indexOf(fn);
if i >= 0 then
  o:=objects[ i] as TcachedTplObj
else
  begin
  o:=TcachedTplObj.create();
  addObject(fn, o);
  end;
result:=o.tpl;
if getMtime(fn) <= o.ts then exit;
o.ts:=getMtime(fn);
o.size:=sizeOfFile(fn);
s:=loadFile(fn);
o.crc:=getCRC(s); // <=== warning line updated
if o.tpl = NIL then
  begin
  result:=Ttpl.create();
  o.tpl:=result;
  end;
o.tpl.fromString(s);
end; // getTplFor
Title: Re: [special:import] translation
Post by: SilentPliz on March 24, 2011, 01:02:53 AM
Very nice Mars ! 8)

This code fix also an very old bug with [+special:strings] ... when we changed template on the fly in different language, it was often remained some slag from previous language.
It is no longer the case!

Thank you! ;)

 
Title: Re: [special:import] translation
Post by: rejetto on March 24, 2011, 05:32:52 PM
thanks for the fix mars.
i also removed the file size check, it's bad criteria, don't know why i opted for it at the time.
But i left the crc check, it's a little optimization to avoid a useless reparsing of the template.

Title: Re: [special:import] translation
Post by: Mars on March 24, 2011, 05:36:00 PM
crc can make mistake because it is possible to have two different files with same size and sams crc. then with a modified tpl if the crc give the same result-> the update is not working.

i think that to calculate the crc take more time than only set text in o. ...
Title: Re: [special:import] translation
Post by: rejetto on March 24, 2011, 06:49:12 PM
ok, i agree
Title: Re: [special:import] translation
Post by: Mars on March 24, 2011, 08:05:02 PM
waiting for build 277 this night  ;D ;)
Title: Re: [special:import] translation
Post by: FRENCH CAN CAN on March 24, 2011, 08:28:16 PM
@rejetto, there is realy a bug, i found the solution ;)

Ha mezz'ora che lo dico ma nessuno mi dava ascolto, grazie comunque per la correzione. ;)

Did I say that half an hour but no one gave me a listen, thanks anyway for the correction. ;)
Title: Re: [special:import] translation
Post by: SilentPliz on March 24, 2011, 08:48:28 PM
It's not really true, if nobody had listened to you, nobody would have checked and corrected the bug.  ;)
Title: Re: [special:import] translation
Post by: FRENCH CAN CAN on March 24, 2011, 10:17:27 PM
Si lo so, ;) ma c'è ne voluto. 8)

Yeah I know, ;) but I wanted there. 8)
Title: Re: [special:import] translation
Post by: rejetto on March 25, 2011, 11:24:32 AM
@French, il bug "tuo" nel primo template che mi hai mandato, c'era. Se non ti avessi ascoltato non potevo trovarlo. ;)
Comunque per riprodurre il "mio" bug bisognava caricare più volte il tuo template, per far rimanere in memoria il valore vecchio. Forse per questo non mi veniva fuori, magari riavviavo HFS.