rejetto forum

[special:import] translation

0 Members and 1 Guest are viewing this topic.

Offline FRENCH CAN CAN

  • Tireless poster
  • ****
    • Posts: 681
    • View Profile
- {.!text.} was not working in [special:import]

it works now? does not appear.  ???


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
- {.!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



Offline FRENCH CAN CAN

  • Tireless poster
  • ****
    • Posts: 681
    • View Profile
[+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.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
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
« Last Edit: March 21, 2011, 08:50:02 PM by Mars »


Offline FRENCH CAN CAN

  • Tireless poster
  • ****
    • Posts: 681
    • View Profile
The command to the macro is this:

[+special:strings]

language=it


these guys have nothing to do:

Italian = it

English = en

Automatic = auto


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
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?


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
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 ;)
« Last Edit: March 22, 2011, 06:24:53 PM by Mars »


Offline FRENCH CAN CAN

  • Tireless poster
  • ****
    • Posts: 681
    • View Profile
I enclose here below the TPL with the problem to be solved:

Allego sotto qui il TPL con il problema da risolvere:


Offline FRENCH CAN CAN

  • Tireless poster
  • ****
    • Posts: 681
    • View Profile
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)


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
@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
 ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
@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 ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
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
.}.}


Offline FRENCH CAN CAN

  • Tireless poster
  • ****
    • Posts: 681
    • View Profile
@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)


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
@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
« Last Edit: March 24, 2011, 01:36:37 AM by SilentPliz »


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
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! ;)