Login   Register  
PHP Classes
elePHPant
Icontem

Class: Translator

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dipl.-Ing.Sarah Schulze  >  Translator  >  Download .tar.gz .zip  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Translator
Base name: merlini18n
Description: A reimplementation of QT's Translator class.
Related classes: , , , , , ,
Version: -
PHP version: -
Licenses: Free for non-commercial use
Q Public License (QPL)
All time users: 1299 users
All time rank: 2461
Week users: 0 users
Week rank: 2420
Picture of Dipl.-Ing.Sarah Schulze
Author: Dipl.-Ing.Sarah Schulze <e-mail contact>
Packages: 1 Browse this author's classes Browse this author's classes
Country: Germany Germany - PHP jobs in Germany
Age: 40
All time rank: 1589114 in Germany Germany
Week rank: 2242 Down135 in Germany Germany Down


  Detailed description  
usage:
1. a file named...example_function.php
2. its contents.....
<?php
/*! TRANSLATOR example_function.php */
function example_function(&$tr)
{
/*! searches only for a translation with in the context of "example_function.php" */
return $B = $tr->translate("example_function.php","This is a TEST");
}
?>

<?php
function example_function(&$tr)
{
/*! does the same than the version above, but searches the whole file for the corresponding translation. */
return $B = $tr->tr("This is a TEST");
}
?>

3. e.g. a main file.....main.php
4. its contents....
<?php
/*! TRANSLATOR main.php */
require_once(_INCLUDE_DIR."merlini18n.h");
require_once(_INCLUDE_DIR."example_function.php");

$tr = new Translator();
$tr->load("trans_".Translator::local(),"i18n/");
/*! sort of overloaded version. see doxygen docu.*/
$tr->load("trans_es.ts","i18n/");

/*! searches only for a translation with in the context of "main.php" */
$A = $tr->translate("main.php","main page");
$B = example_function($tr);

/*! does the same than the version above, but searches the whole file for the corresponding translation. */
$C = $tr->tr("main page");
........etc.
?>

5. the translation file.....trans_es.ts, made by lupdate.
6. its contents..
<!DOCTYPE TS><TS>
<context>
<name>main.php</name>
<message>
<source>main page</source>
<translation>pagina principal</translation>
</message>
</context>
<context>
<name>example_function.php</name>
<message>
<source>This is a TEST</source>
<translation>Esto es una prueba</translation>
</message>
</context>
</TS>

7. of course one can also use special characters inside the translation file following UTF-8.
8. Thats all for now.

 

  Groups  
Group folder image XML XML parsing and generation View top rated classes
Group folder image Localization Internationalization and translations View top rated classes

  Rate classes User ratings   Applications   Files Files  

  User ratings  
There are not enough user ratings to display for this class.

  Applications that use this class  
No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.
  Files folder image Files  
File Role Description
Accessible without login Plain text file merlini18n.h ??? Translator class
Plain text file merlini18_doxyconf ??? example Doxygen conf file

Download all files: merlini18n.tar.gz merlini18n.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.