Changes

Jump to navigation Jump to search
Line 137: Line 137:  
# and sometimes a file in here: /usr/share/perl5/vendor_perl/esmith/FormMagick/Panel  Although in this case there is not. (and I find that directory structure impossible to remember - "esmith" sans "-" throws me).
 
# and sometimes a file in here: /usr/share/perl5/vendor_perl/esmith/FormMagick/Panel  Although in this case there is not. (and I find that directory structure impossible to remember - "esmith" sans "-" throws me).
 
# and translatable strings in here:  /etc/e-smith/locale/en-us/etc/e-smith/web/functions/<contrib name> the format is XML- like whereas SM2 requires a more perl l- ike structure.  
 
# and translatable strings in here:  /etc/e-smith/locale/en-us/etc/e-smith/web/functions/<contrib name> the format is XML- like whereas SM2 requires a more perl l- ike structure.  
Here is a sed script and extra commands to take a formMagick strings file and make it into a lex file suitable for SM2.
+
   
 
  −
Create a sed script file (cnv_lexi.vi):<syntaxhighlight lang="text">
  −
/lexicon/ d
  −
/entry/ d
  −
s/'/\\'/g
  −
s/<base>/'ddc_/
  −
s/<\/base>/' => /
  −
s/<trans>/'/
  −
s/<\/trans>/',/
  −
s/\t//g
  −
s/<!\[CDATA\[//g
  −
s/]]>//g
  −
/^$/d
  −
s/        '/'/g
  −
s/        //g
  −
s/=> \n/=> /g
  −
</syntaxhighlight>Then the shell script to run it: (extractlex.sh):<syntaxhighlight>
  −
#!/bin/sh
  −
cp /etc/e-smith/locale/en-us/etc/e-smith/web/functions/$1 $1.res
  −
sed -f cnv_lexi.vi /etc/e-smith/locale/en-us/etc/e-smith/web/functions/$1 $1.res | tr "\n" "~" | sed 's/\s+~/~/g' | sed 's/~,/,/g' | sed "s/~'~/'/g" | sed s/"~',~'/',~/g" | tr "~" "\n" > $1.lex
  −
 
  −
</syntaxhighlight>Run it by:
  −
  ./extractlexi.sh dhcpd
      
I have not really understood how formMagick works, but mostly the subroutine names and code shows what is needed.
 
I have not really understood how formMagick works, but mostly the subroutine names and code shows what is needed.
Line 348: Line 325:     
==Translation Strings files==
 
==Translation Strings files==
 +
Here is a sed script and extra commands to take a formMagick strings file and make it into a lex file suitable for SM2.
 +
 +
 +
 +
Create a sed script file (cnv_lexi.vi):<syntaxhighlight lang="text">
 +
/lexicon/ d
 +
/entry/ d
 +
s/'/\\'/g
 +
s/<base>/'ddc_/
 +
s/<\/base>/' => /
 +
s/<trans>/'/
 +
s/<\/trans>/',/
 +
s/\t//g
 +
s/<!\[CDATA\[//g
 +
s/]]>//g
 +
/^$/d
 +
s/        '/'/g
 +
s/        //g
 +
s/=> \n/=> /g
 +
</syntaxhighlight>Then the shell script to run it: (extractlex.sh):<syntaxhighlight>
 +
#!/bin/sh
 +
cp /etc/e-smith/locale/en-us/etc/e-smith/web/functions/$1 $1.res
 +
sed -f cnv_lexi.vi /etc/e-smith/locale/en-us/etc/e-smith/web/functions/$1 $1.res | tr "\n" "~" | sed 's/\s+~/~/g' | sed 's/~,/,/g' | sed "s/~'~/'/g" | sed s/"~',~'/',~/g" | tr "~" "\n" > $1.lex
 +
 +
</syntaxhighlight>Run it by:
 +
./extractlexi.sh dhcpd
 +
You will need to edit the "ddc_" prefix in the .lex file to conform to whatever you want to use.
 +
 +
Then run:
 +
 +
/etc/e-smith/events/actions/locales2-conf
 +
 +
Which will loop through all the lex files and create corresponding .pm files where they do not exist.  This could go in the (rpm) install inside the createlinks file (remember to delete the .pm file(s) first).
    
=== The .lex File ===
 
=== The .lex File ===

Navigation menu