[PC-BSD Commits] r2273 - in websites: bsdstats.org/bsdstats/etc bsdstats.org/bsdstats/slib pbidir.com/bibivu/etc pbidir.com/bibivu/slib
svn at pcbsd.org
svn at pcbsd.org
Thu Jul 3 07:03:09 PDT 2008
Author: fabry
Date: 2008-07-03 07:03:00 -0700 (Thu, 03 Jul 2008)
New Revision: 2273
Modified:
websites/bsdstats.org/bsdstats/etc/lang.conf.php
websites/bsdstats.org/bsdstats/slib/lang.php
websites/pbidir.com/bibivu/etc/display.conf.php
websites/pbidir.com/bibivu/etc/lang.conf.php
websites/pbidir.com/bibivu/slib/lang.php
Log:
a few modifications to better support UTF-8 languages.
Modified: websites/bsdstats.org/bsdstats/etc/lang.conf.php
===================================================================
--- websites/bsdstats.org/bsdstats/etc/lang.conf.php 2008-07-03 12:29:52 UTC (rev 2272)
+++ websites/bsdstats.org/bsdstats/etc/lang.conf.php 2008-07-03 14:03:00 UTC (rev 2273)
@@ -1,5 +1,22 @@
<?php
-$lang['detect'] = true; //if false will ONLY use the lang['lang']
-$lang['lang'] = 'en'; //if no language is detected, or if translation doesnt exists, use this one as default
-$lang['supported'] = array('en', 'es', 'it', 'de', 'fr', 'tr', 'nl');
+$lang['detect'] = true; //if false will ONLY use the lang['lang']
+$lang['lang'] = 'en'; //if no language is detected, or if translation doesnt exists, use this one as default
+
+/*
+ translate those languages strings into HTML chars (but not the tags)
+ this is very helpful in case you wrote the language text without using html code
+ for ecample, this will translate the string
+ - Últimos
+ into
+ - Últimos
+
+ but it will NOT translate the already HTML chars, this means that Últimos will not be translate into &Uacute;ltimos
+
+ if thelanguage fils is written in UTF-8, remove it from this list
+
+*/
+
+$lang['toHTML'] = array('en', 'es', 'it', 'de', 'fr', 'tr', 'nl');
+
+$lang['supported'] = array('en', 'es', 'it', 'de', 'fr', 'tr', 'nl', 'ru');
?>
\ No newline at end of file
Modified: websites/bsdstats.org/bsdstats/slib/lang.php
===================================================================
--- websites/bsdstats.org/bsdstats/slib/lang.php 2008-07-03 12:29:52 UTC (rev 2272)
+++ websites/bsdstats.org/bsdstats/slib/lang.php 2008-07-03 14:03:00 UTC (rev 2273)
@@ -45,7 +45,24 @@
//I set the current key as the default
$this->words[$lang][$word] = $default!=''?$default:$word;
}
- return $this->words[$lang][$word];
+ $return = $this->words[$lang][$word];
+ //do I have to translate the text in HTML ?
+ if(in_array($lang,$this->config['toHTML'])){
+ // Take all the html entities
+ $caracteres = get_html_translation_table(HTML_ENTITIES);
+ // Find out the "tags" entities
+ $remover = get_html_translation_table(HTML_SPECIALCHARS);
+ // Spit out the tags entities from the original table
+ $caracteres = array_diff($caracteres, $remover);
+ // Translate the string....
+ $return = strtr($return, $caracteres);
+ // And that's it!
+
+ if($return==''){
+ $return = $this->words[$lang][$word];
+ }
+ }
+ return $return;
}
public function load_lang($language, $file = ''){
Modified: websites/pbidir.com/bibivu/etc/display.conf.php
===================================================================
--- websites/pbidir.com/bibivu/etc/display.conf.php 2008-07-03 12:29:52 UTC (rev 2272)
+++ websites/pbidir.com/bibivu/etc/display.conf.php 2008-07-03 14:03:00 UTC (rev 2273)
@@ -17,7 +17,8 @@
//$display['headers']['Cache-Control'][2] = 'private';
$display['meta'][0]['http-equiv'] = 'Content-type';
-$display['meta'][0]['content'] = 'text/html; charset=iso-8859-1';
+//$display['meta'][0]['content'] = 'text/html; charset=iso-8859-1';
+$display['meta'][0]['content'] = 'text/html; charset=utf-8';
$display['meta'][1]['name'] = 'Author';
$display['meta'][1]['content'] = 'Fabrizio Parrella';
Modified: websites/pbidir.com/bibivu/etc/lang.conf.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang.conf.php 2008-07-03 12:29:52 UTC (rev 2272)
+++ websites/pbidir.com/bibivu/etc/lang.conf.php 2008-07-03 14:03:00 UTC (rev 2273)
@@ -1,5 +1,22 @@
<?php
-$lang['detect'] = true; //if false will ONLY use the lang['lang']
-$lang['lang'] = 'en'; //if no language is detected, or if translation doesnt exists, use this one as default
-$lang['supported'] = array('en', 'es', 'it', 'de', 'fr', 'tr', 'nl', 'ru');
+$lang['detect'] = true; //if false will ONLY use the lang['lang']
+$lang['lang'] = 'en'; //if no language is detected, or if translation doesnt exists, use this one as default
+
+/*
+ translate those languages strings into HTML chars (but not the tags)
+ this is very helpful in case you wrote the language text without using html code
+ for ecample, this will translate the string
+ - Últimos
+ into
+ - Últimos
+
+ but it will NOT translate the already HTML chars, this means that Últimos will not be translate into &Uacute;ltimos
+
+ if thelanguage fils is written in UTF-8, remove it from this list
+
+*/
+
+$lang['toHTML'] = array('en', 'es', 'it', 'de', 'fr', 'tr', 'nl');
+
+$lang['supported'] = array('en', 'es', 'it', 'de', 'fr', 'tr', 'nl', 'ru');
?>
\ No newline at end of file
Modified: websites/pbidir.com/bibivu/slib/lang.php
===================================================================
--- websites/pbidir.com/bibivu/slib/lang.php 2008-07-03 12:29:52 UTC (rev 2272)
+++ websites/pbidir.com/bibivu/slib/lang.php 2008-07-03 14:03:00 UTC (rev 2273)
@@ -45,7 +45,24 @@
//I set the current key as the default
$this->words[$lang][$word] = $default!=''?$default:$word;
}
- return $this->words[$lang][$word];
+ $return = $this->words[$lang][$word];
+ //do I have to translate the text in HTML ?
+ if(in_array($lang,$this->config['toHTML'])){
+ // Take all the html entities
+ $caracteres = get_html_translation_table(HTML_ENTITIES);
+ // Find out the "tags" entities
+ $remover = get_html_translation_table(HTML_SPECIALCHARS);
+ // Spit out the tags entities from the original table
+ $caracteres = array_diff($caracteres, $remover);
+ // Translate the string....
+ $return = strtr($return, $caracteres);
+ // And that's it!
+
+ if($return==''){
+ $return = $this->words[$lang][$word];
+ }
+ }
+ return $return;
}
public function load_lang($language, $file = ''){
More information about the Commits
mailing list