[Openupload-svn-update] SF.net SVN: openupload:[87] trunk/lib/modules/tr
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2008-10-28 17:36:30
|
Revision: 87
http://openupload.svn.sourceforge.net/openupload/?rev=87&view=rev
Author: tsdogs
Date: 2008-10-28 17:36:20 +0000 (Tue, 28 Oct 2008)
Log Message:
-----------
Rename php translator
Added Paths:
-----------
trunk/lib/modules/tr/phparray.inc.php
Removed Paths:
-------------
trunk/lib/modules/tr/array.inc.php
Deleted: trunk/lib/modules/tr/array.inc.php
===================================================================
--- trunk/lib/modules/tr/array.inc.php 2008-10-27 11:42:03 UTC (rev 86)
+++ trunk/lib/modules/tr/array.inc.php 2008-10-28 17:36:20 UTC (rev 87)
@@ -1,64 +0,0 @@
-<?php
-
-/* simple array translation */
-
-class ArrayTranslator extends translatorBase {
-var $update = false;
-var $TR;
-
- function ArrayTranslator() {
- }
-
- function init() {
- $locale = app()->user->info('lang');
- $lang = app()->langs[$locale];
- $tr = array();
- $this->files['openupload']=app()->config['INSTALL_ROOT'].'/locale/'.$lang['id'].'.inc.php';
- if (file_exists($this->files['openupload'])) {
- require_once($this->files['openupload']);
- $this->TR['openupload']=$tr;
- }
- $tr = array();
- $this->files['template']=app()->config['INSTALL_ROOT'].'/templates/'.app()->config['site']['template'].
- '/locale/'.$lang['id'].'.inc.php';
- if (file_exists($this->files['template'])) {
- require_once($this->files['template']);
- $this->TR['template']=$tr;
- } else { /* load default translation */
- $this->files['template']=app()->config['INSTALL_ROOT'].'/templates/'.
- 'default/locale/'.$lang['id'].'.inc.php';
- if (file_exists($this->files['template'])) {
- require_once($this->files['template']);
- $this->TR['template']=$tr;
- }
- }
- /* setup page encoding */
- if (isset($lang['charset']))
- header('Content-Type: text/html; charset='.$lang['charset']);
- }
-
-
- function translate($txt,$domain = 'openupload') {
-
- if (isset($this->TR[$domain][$txt])) {
- return $this->TR[$domain][$txt];
- } else {
- if ($this->update) {
- /* add the translation to the file */
- $f = @fopen($this->files[$domain],'w+');
- if ($f) {
- fwrite($f,'<?php'."\n");
- foreach ($this->TR[$domain] as $k => $v) {
- fwrite($f,'$tr[\''.str_replace("'","\'",$k).'\']=\''.str_replace("'","\'",$v).'\';'."\n");
- }
- fwrite($f,'$tr[\''.str_replace("'","\'",$txt).'\']=\''.str_replace("'","\'",$txt).'\';'."\n");
- fwrite($f,'?>');
- fclose($f);
- $this->TR[$domain][$txt]=$txt;
- }
- }
- return $txt;
- }
- }
-}
-?>
\ No newline at end of file
Added: trunk/lib/modules/tr/phparray.inc.php
===================================================================
--- trunk/lib/modules/tr/phparray.inc.php (rev 0)
+++ trunk/lib/modules/tr/phparray.inc.php 2008-10-28 17:36:20 UTC (rev 87)
@@ -0,0 +1,64 @@
+<?php
+
+/* simple array translation */
+
+class PhpArrayTranslator extends translatorBase {
+var $update = false;
+var $TR;
+
+ function PhpArrayTranslator() {
+ }
+
+ function init() {
+ $locale = app()->user->info('lang');
+ $lang = app()->langs[$locale];
+ $tr = array();
+ $this->files['openupload']=app()->config['INSTALL_ROOT'].'/locale/'.$lang['id'].'.inc.php';
+ if (file_exists($this->files['openupload'])) {
+ require_once($this->files['openupload']);
+ $this->TR['openupload']=$tr;
+ }
+ $tr = array();
+ $this->files['template']=app()->config['INSTALL_ROOT'].'/templates/'.app()->config['site']['template'].
+ '/locale/'.$lang['id'].'.inc.php';
+ if (file_exists($this->files['template'])) {
+ require_once($this->files['template']);
+ $this->TR['template']=$tr;
+ } else { /* load default translation */
+ $this->files['template']=app()->config['INSTALL_ROOT'].'/templates/'.
+ 'default/locale/'.$lang['id'].'.inc.php';
+ if (file_exists($this->files['template'])) {
+ require_once($this->files['template']);
+ $this->TR['template']=$tr;
+ }
+ }
+ /* setup page encoding */
+ if (isset($lang['charset']))
+ header('Content-Type: text/html; charset='.$lang['charset']);
+ }
+
+
+ function translate($txt,$domain = 'openupload') {
+
+ if (isset($this->TR[$domain][$txt])) {
+ return $this->TR[$domain][$txt];
+ } else {
+ if ($this->update) {
+ /* add the translation to the file */
+ $f = @fopen($this->files[$domain],'w+');
+ if ($f) {
+ fwrite($f,'<?php'."\n");
+ foreach ($this->TR[$domain] as $k => $v) {
+ fwrite($f,'$tr[\''.str_replace("'","\'",$k).'\']=\''.str_replace("'","\'",$v).'\';'."\n");
+ }
+ fwrite($f,'$tr[\''.str_replace("'","\'",$txt).'\']=\''.str_replace("'","\'",$txt).'\';'."\n");
+ fwrite($f,'?>');
+ fclose($f);
+ $this->TR[$domain][$txt]=$txt;
+ }
+ }
+ return $txt;
+ }
+ }
+}
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|