rejetto forum
Software => HFS ~ HTTP File Server => Beta => Topic started 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. ???
-
- {.!text.} was not working in [special:import]
it works now? does not appear. ???
work for me with build 276
[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
-
[+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.
-
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
-
The command to the macro is this:
[+special:strings]
language=it
these guys have nothing to do:
Italian = it
English = en
Automatic = auto
-
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?
-
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 ;)
-
I enclose here below the TPL with the problem to be solved:
Allego sotto qui il TPL con il problema da risolvere:
-
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)
-
@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
;)
-
@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 ;)
-
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
.}.}
-
@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.
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)
-
@rejetto, there is realy a bug, i found the solution ;)
classeslib.pas
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
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
-
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! ;)
-
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.
-
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. ...
-
ok, i agree
-
waiting for build 277 this night ;D ;)
-
@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. ;)
-
It's not really true, if nobody had listened to you, nobody would have checked and corrected the bug. ;)
-
Si lo so, ;) ma c'è ne voluto. 8)
Yeah I know, ;) but I wanted there. 8)
-
@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.