[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: developer_tools/inc class.bolangfile.inc.php,1.8
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: developer_tools/inc class.bolangfile.inc.php,1.8.2.2.2.1,1.8.2.2.2.2 class.solangfile.inc.php,1.9.2.4.2.2,1.9.2.4.2.3 class.uilangfile.inc.php,1.10.2.1.2.1,1.10.2.1.2.2 |
Date: |
Sat, 05 Apr 2003 17:11:02 -0500 |
Update of /cvsroot/phpgroupware/developer_tools/inc
In directory subversions:/tmp/cvs-serv23355/inc
Modified Files:
Tag: Version-0_9_16-branch
class.bolangfile.inc.php class.solangfile.inc.php
class.uilangfile.inc.php
Log Message:
use textarea's for long messages,
fixed handling of entities in the phrases,
clearefied the order of the necessary steps
Index: class.bolangfile.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/developer_tools/inc/class.bolangfile.inc.php,v
retrieving revision 1.8.2.2.2.1
retrieving revision 1.8.2.2.2.2
diff -C2 -r1.8.2.2.2.1 -r1.8.2.2.2.2
*** class.bolangfile.inc.php 5 Apr 2003 03:24:40 -0000 1.8.2.2.2.1
--- class.bolangfile.inc.php 5 Apr 2003 22:11:00 -0000 1.8.2.2.2.2
***************
*** 16,22 ****
var $total;
var $debug = False;
- var $public_functions = array(
- 'index' => True
- );
var $so;
var $loaded_apps = array();
--- 16,19 ----
***************
*** 26,29 ****
--- 23,27 ----
var $common_langarray = '';
var $src_file;
+ var $src_apps = '';
var $tgt_file;
var $tgt_lang;
***************
*** 37,51 ****
}
- function cmp($a,$b)
- {
- $c = strtolower($a);
- $d = strtolower($b);
- if ($c == $d)
- {
- return 0;
- }
- return ($c < $d) ? -1 : 1;
- }
-
/* Sessions used to save state and not reread the langfile
between adding/deleting phrases */
function save_sessiondata($source,$target)
--- 35,38 ----
***************
*** 59,62 ****
--- 46,50 ----
$GLOBALS['phpgw']->session->appsession('developer_t_lang','developer_tools',$this->tgt_lang);
$GLOBALS['phpgw']->session->appsession('developer_loaded_apps','developer_tools',$this->loaded_apps);
+
$GLOBALS['phpgw']->session->appsession('developer_src_apps','developer_tools',$this->src_apps);
}
***************
*** 73,82 ****
$tgt_lang =
$GLOBALS['phpgw']->session->appsession('developer_t_lang','developer_tools');
$loaded_apps =
$GLOBALS['phpgw']->session->appsession('developer_loaded_apps','developer_tools');
!
$this->set_sessiondata($source,$target,$src_file,$tgt_file,$tgt_lang,$loaded_apps);
! return;
}
! function
set_sessiondata($source,$target,$src_file,$tgt_file,$tgt_lang,$loaded_apps)
{
$this->source_langarray = $source;
--- 61,70 ----
$tgt_lang =
$GLOBALS['phpgw']->session->appsession('developer_t_lang','developer_tools');
$loaded_apps =
$GLOBALS['phpgw']->session->appsession('developer_loaded_apps','developer_tools');
+ $src_apps =
$GLOBALS['phpgw']->session->appsession('developer_src_apps','developer_tools');
!
$this->set_sessiondata($source,$target,$src_file,$tgt_file,$tgt_lang,$loaded_apps,$src_apps);
}
! function
set_sessiondata($source,$target,$src_file,$tgt_file,$tgt_lang,$loaded_apps,$src_apps)
{
$this->source_langarray = $source;
***************
*** 86,90 ****
$this->tgt_lang = $tgt_lang;
$this->loaded_apps = $loaded_apps;
!
}
--- 74,78 ----
$this->tgt_lang = $tgt_lang;
$this->loaded_apps = $loaded_apps;
! $this->src_apps = $src_apps;
}
***************
*** 115,120 ****
);
@ksort($this->source_langarray);
- /* _debug_array($this->source_langarray);exit; */
- return;
}
--- 103,106 ----
***************
*** 140,157 ****
}
}
- /*echo '<HR>'.$mess.'<HR><pre>';
- print_r($this->source_langarray[$mess]);
- print_r($this->missing_langarray);
- echo '</pre>';*/
- return;
}
function missing_app($app,$userlang='en')
{
- //$this->src_file = $this->so->src_file;
- //if ($this->missing_langarray=='')
- //{
- //$this->missing_langarray=array();
-
if (!is_array($this->common_langarray))
{
--- 126,133 ----
***************
*** 161,165 ****
while (list($p,$loc) = each($plist))
{
- // if
((!$this->source_langarray[strtolower($p)])&&(!$this->source_langarray[$p]))
$_mess_id = strtolower(trim($p));
if (!empty($_mess_id) &&
!$this->source_langarray[$_mess_id] && !$this->common_langarray[$_mess_id])
--- 137,140 ----
***************
*** 170,174 ****
}
}
- //}
if (is_array($this->missing_langarray))
{
--- 145,148 ----
***************
*** 176,180 ****
@ksort($this->missing_langarray);
}
- //
$this->save_sessiondata($this->bo->source_langarray,$this->bo->target_langarray);
return $this->missing_langarray;
}
--- 150,153 ----
***************
*** 189,192 ****
--- 162,166 ----
$this->src_file = $this->so->src_file;
$this->loaded_apps = $this->so->loaded_apps;
+ $this->src_apps = $this->so->src_apps;
return $this->source_langarray;
}
Index: class.solangfile.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/developer_tools/inc/class.solangfile.inc.php,v
retrieving revision 1.9.2.4.2.2
retrieving revision 1.9.2.4.2.3
diff -C2 -r1.9.2.4.2.2 -r1.9.2.4.2.3
*** class.solangfile.inc.php 5 Apr 2003 03:24:41 -0000 1.9.2.4.2.2
--- class.solangfile.inc.php 5 Apr 2003 22:11:00 -0000 1.9.2.4.2.3
***************
*** 42,59 ****
}
- function isin_array($needle,$haystack)
- {
- while (list ($k,$v) = each($haystack))
- {
- if ($v == $needle)
- {
- return True;
- }
- }
- return False;
- }
-
-
- //Known Issue, if a phrase contains a ' or a " the parse will
be thrown off. unless ' are nested inside " or vice versa
function parse_php_app($fd,$plist)
{
--- 42,45 ----
***************
*** 125,157 ****
}
}
- /*
- $fd=fopen($fd.SEP.$fn,'r');
- $fds=substr($fd,strpos($fd,SEP));
- while (!feof($fp))
- {
- $str=fgets($fp,8192);
- while
(strlen($str=$this->strstr_multiple($str,'lang','(','')))
- {
- if ($str[0]=="\"" ||
$str[0]=="'")
- {
- if ($str[0] ==
"'")
- {
-
$str=substr($str,1);
-
$s2=substr($str,0,strpos($str,"'"));
- }
- else
- {
-
$str=substr($str,1);
-
$s2=substr($str,0,strpos($str,"\""));
- }
- if ($s2!='')
- {
-
$plist[$s2]=$fds;
- }
- }
- }
- }
- fclose($fp);
- */
}
}
--- 111,114 ----
***************
*** 160,200 ****
}
- /*!
- @function strstr_multiple
- @abstract search for a substring consisted of parts separated
by whitespaces
- @param $str original string
- @param $sub1 first part of substring
- @param $sub2 second part of substring
- @result returns portion of $str from the end of substring to
the end of $str, or empty string if substring was not found
- */
- /* function strstr_multiple($str,$sub1,$sub2)
- {
- if (isset($sub1))
- {
- if(is_integer($pos=strpos($str,$sub1)))
- {
- $str=substr($str,$pos+strlen($sub1));
- if (isset($sub2))
- {
- $str=ltrim($str);
- if(substr($str,0,strlen($sub2))
== $sub2)
- {
-
$str=substr($str,strlen($sub2));
- return $str;
- }
- }
- else
- {
- return $str;
- }
- }
- }
- else
- {
- return $str;
- }
- return "";
- }
- */
function missing_app($app,$userlang=en)
{
--- 117,120 ----
***************
*** 223,226 ****
--- 143,148 ----
$wr = True;
}
+ $this->src_apps = array($app => $app);
+
if (file_exists($fn))
{
***************
*** 236,242 ****
//echo '<br>add_app(): adding phrase:
$this->langarray["'.$message_id.'"]=' . trim($content);
$_mess_id =
strtolower(trim($message_id));
$this->langarray[$_mess_id]['message_id'] = $_mess_id;
! $this->langarray[$_mess_id]['app_name']
= trim($app_name);
$this->langarray[$_mess_id]['content']
= trim($content);
}
fclose($fp);
--- 158,166 ----
//echo '<br>add_app(): adding phrase:
$this->langarray["'.$message_id.'"]=' . trim($content);
$_mess_id =
strtolower(trim($message_id));
+ $app_name = trim($app_name);
$this->langarray[$_mess_id]['message_id'] = $_mess_id;
! $this->langarray[$_mess_id]['app_name']
= $app_name;
$this->langarray[$_mess_id]['content']
= trim($content);
+ $this->src_apps[$app_name] = $app_name;
}
fclose($fp);
***************
*** 306,310 ****
function list_langs()
{
! $this->db->query("SELECT lang_id,lang_name FROM
phpgw_languages ORDER BY lang_name");
$i = 0;
while ($this->db->next_record())
--- 230,243 ----
function list_langs()
{
! $this->db->query("SELECT DISTINCT lang FROM
phpgw_lang");
! while($this->db->next_record())
! {
! $lang = $this->db->f('lang');
! $installed[] = $lang;
! }
! $installed = "('".implode("','",$installed)."')";
!
! // this shows first the installed, then the available
and then the rest
! $this->db->query("SELECT lang_id,lang_name,lang_id IN
$installed as installed FROM phpgw_languages ORDER BY installed DESC,available
DESC,lang_name");
$i = 0;
while ($this->db->next_record())
Index: class.uilangfile.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/developer_tools/inc/class.uilangfile.inc.php,v
retrieving revision 1.10.2.1.2.1
retrieving revision 1.10.2.1.2.2
diff -C2 -r1.10.2.1.2.1 -r1.10.2.1.2.2
*** class.uilangfile.inc.php 5 Apr 2003 03:24:41 -0000 1.10.2.1.2.1
--- class.uilangfile.inc.php 5 Apr 2003 22:11:00 -0000 1.10.2.1.2.2
***************
*** 50,58 ****
echo '<br>' . lang('Loading source langfile') . ': ' .
$sourcelang . '... ';
echo $this->bo->loaddb($app_name,$sourcelang);
! echo '<br>' . lang('Loading target langfile') . ': ' .
$targetlang . '... ';
! echo $this->bo->loaddb($app_name,$targetlang);
!
! echo '<br><a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. $app_name
! . '&sourcelang=' . $sourcelang . '&targetlang='
. $targetlang) . '">' . lang('Ok') . '</a>';
}
--- 50,60 ----
echo '<br>' . lang('Loading source langfile') . ': ' .
$sourcelang . '... ';
echo $this->bo->loaddb($app_name,$sourcelang);
! if ($sourcelang != $targetlang)
! {
! echo '<br>' . lang('Loading target langfile') .
': ' . $targetlang . '... ';
! echo $this->bo->loaddb($app_name,$targetlang);
! }
! echo '<br><form method="post" action="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. $app_name
! . '&sourcelang=' . $sourcelang . '&targetlang='
. $targetlang) . '"><input type="submit" name="Ok" value="' . lang('Ok') .
'"></from>';
}
***************
*** 125,132 ****
$this->template->set_block('langfile','detail','detail');
$this->template->set_block('langfile','prefooter','prefooter');
-
$this->template->set_block('langfile','srcwrite','srcwrite');
-
$this->template->set_block('langfile','tgtwrite','tgtwrite');
-
$this->template->set_block('langfile','srcdownload','srcdownload');
-
$this->template->set_block('langfile','tgtdownload','tgtdownload');
$this->template->set_block('langfile','footer','footer');
if(!$sourcelang)
--- 127,130 ----
***************
*** 146,151 ****
if($_checked == 'on')
{
! $_mess =
$this->htmlspecialchars($_mess,True);
! $this->bo->movephrase($_mess);
/*
_debug_array($missingarray[$_mess]); */
unset($missingarray[$_mess]);
--- 144,149 ----
if($_checked == 'on')
{
! $id =
$this->htmlspecialchars($_mess,True);
! $this->bo->movephrase($id);
/*
_debug_array($missingarray[$_mess]); */
unset($missingarray[$_mess]);
***************
*** 171,180 ****
$this->template->set_var('lang_remove',lang('Add
phrase'));
$this->template->set_var('lang_application',lang('Application'));
- // $this->template->set_var('lang_source',lang('Source
Language'));
- // $this->template->set_var('lang_target',lang('Target
Language'));
- //
$this->template->set_var('lang_submit',lang('Submit'));
$this->template->set_var('lang_update',lang('Save'));
- //$this->template->set_var('lang_write',lang('Write'));
- //
$this->template->set_var('lang_cancel',lang('Cancel'));
$this->template->set_var('lang_view',lang('Back'));
$languages = $this->bo->list_langs();
--- 169,173 ----
***************
*** 213,218 ****
}
$this->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.missingphrase'));
! $this->template->set_var('sourcelangs',$sourcelangs);
! $this->template->set_var('targetlangs',$targetlangs);
$this->template->set_var('app_name',$app_name);
$this->template->set_var('app_title',$GLOBALS['phpgw_info']['apps'][$app_name]['title']);
--- 206,211 ----
}
$this->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.missingphrase'));
! $this->template->set_var('sourcelang',$sourcelang);
! $this->template->set_var('targetlang',$targetlang);
$this->template->set_var('app_name',$app_name);
$this->template->set_var('app_title',$GLOBALS['phpgw_info']['apps'][$app_name]['title']);
***************
*** 223,227 ****
$this->template->set_var('lang_message',lang('Message'));
$this->template->set_var('lang_original',lang('Original'));
-
//$this->template->set_var('lang_translation',lang('Translation'));
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$this->template->set_var('view_link',
--- 216,219 ----
***************
*** 232,267 ****
);
$this->template->pfp('out','postheader');
- //Is this needed? $translation is never used
and bo->load_app() does nothing here.
$translation =
$this->bo->load_app($app_name,$targetlang);
- //
$this->template->set_var('src_file',$this->bo->src_file);
while(list($key,$data) = @each($missingarray))
{
$mess_id =
$this->htmlspecialchars($key);
$content = $data['content'];
- // $transy = $content;
$this->template->set_var('mess_id',$mess_id);
$this->template->set_var('source_content',htmlspecialchars($content));
- //
$this->template->set_var('content',$GLOBALS['phpgw']->strip_html($transy));
$this->template->set_var('transapp',$this->lang_option($app_name,$data['app_name'],$mess_id));
$this->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
$this->template->pfp('out','detail');
}
- //
$this->template->set_var('sourcelang',$sourcelang);
- //
$this->template->set_var('targetlang',$targetlang);
- //
$this->template->set_var('app_name',$app_name);
$this->template->pfp('out','prefooter');
- // $this->template->pfp('out','srcdownload');
-
//if($this->bo->loaded_apps[$sourcelang]['writeable'])
- //{
- // $this->template->pfp('out','srcwrite');
- //}
-
- //
$this->template->set_var('tgt_file',$this->bo->tgt_file);
- //
$this->template->set_var('targetlang',$targetlang);
- // $this->template->pfp('out','tgtdownload');
- //
if($this->bo->loaded_apps[$targetlang]['writeable'])
- // {
- // $this->template->pfp('out','tgtwrite');
- // }
$this->template->pfp('out','footer');
}
--- 224,239 ----
***************
*** 323,331 ****
$this->template->set_block('langfile','postheader','postheader');
$this->template->set_block('langfile','detail','detail');
!
$this->template->set_block('langfile','prefooter','prefooter');
!
$this->template->set_block('langfile','srcwrite','srcwrite');
!
$this->template->set_block('langfile','tgtwrite','tgtwrite');
!
$this->template->set_block('langfile','srcdownload','srcdownload');
!
$this->template->set_block('langfile','tgtdownload','tgtdownload');
$this->template->set_block('langfile','footer','footer');
--- 295,299 ----
$this->template->set_block('langfile','postheader','postheader');
$this->template->set_block('langfile','detail','detail');
!
$this->template->set_block('langfile','detail_long','detail_long');
$this->template->set_block('langfile','footer','footer');
***************
*** 343,346 ****
--- 311,325 ----
$this->template->set_var('lang_revert',lang('Revert'));
$this->template->set_var('lang_cancel',lang('Cancel'));
+ $this->template->set_var('lang_step',lang('Step'));
+ $help = 'onMouseOver="self.status=\'%s\'; return true;"
onMouseOut="self.status=\'\'; return true;"';
+
$this->template->set_var('cancel_help',sprintf($help,lang('Returns to the
application list, not saved changes get lost !!!')));
+
$this->template->set_var('load_help',sprintf($help,lang('Loads the selected
lang-files, to be modified in the next steps')));
+
$this->template->set_var('update_help',sprintf($help,lang('Saves the
added/changed translations to an internal buffer, to be used in further
steps')));
+
$this->template->set_var('search_help',sprintf($help,lang('Searches the
source-code for phrases not in the actual source-lang-file')));
+
$this->template->set_var('add_help',sprintf($help,lang('Allows you to add a
single phrase')));
+
$this->template->set_var('revert_help',sprintf($help,lang('Clears the internal
buffer, all changes made sofar are lost')));
+
$this->template->set_var('download_help',sprintf($help,lang('Download the
lang-file to be saved in the apps setup-dir')));
+
$this->template->set_var('write_help',sprintf($help,lang('Write the lang-file
to the apps setup-dir')));
+
$this->template->set_var('loaddb_help',sprintf($help,lang('Updates the
translations of both lang-files in your database, so you can verify your work
imediatly')));
$languages = $this->bo->list_langs();
***************
*** 484,488 ****
$langarray =
$this->bo->add_app($app_name,$sourcelang);
$translation =
$this->bo->load_app($app_name,$targetlang);
-
$this->template->set_var('src_file',$this->bo->src_file);
while(list($key,$data) = @each($langarray))
--- 463,466 ----
***************
*** 496,500 ****
$this->template->set_var('transapp',$this->lang_option($app_name,$data['app_name'],$mess_id));
$this->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
! $this->template->pfp('out','detail');
}
$this->template->set_var('sourcelang',$sourcelang);
--- 474,486 ----
$this->template->set_var('transapp',$this->lang_option($app_name,$data['app_name'],$mess_id));
$this->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
! if (strlen($key) > 50)
! {
!
$this->template->set_var('rows',min(intval(strlen($key)/80+0.5),10));
!
$this->template->pfp('out','detail_long');
! }
! else
! {
!
$this->template->pfp('out','detail');
! }
}
$this->template->set_var('sourcelang',$sourcelang);
***************
*** 502,523 ****
$this->template->set_var('lang_write',lang('Write'));
$this->template->set_var('lang_download',lang('Download'));
!
! $this->template->pfp('out','prefooter');
! $this->template->pfp('out','srcdownload');
!
!
if($this->bo->loaded_apps[$sourcelang]['writeable'])
{
! $this->template->pfp('out','srcwrite');
}
-
$this->template->set_var('tgt_file',$this->bo->tgt_file);
$this->template->set_var('targetlang',$targetlang);
! $this->template->pfp('out','tgtdownload');
!
if($this->bo->loaded_apps[$targetlang]['writeable'])
{
! $this->template->pfp('out','tgtwrite');
}
- $this->template->set_var('helpmsg',lang('!!!
You have to [Save] your changes before you can [Update Database], [Download] or
[Write] the lang-file !!!'));
$this->template->pfp('out','footer');
}
--- 488,506 ----
$this->template->set_var('lang_write',lang('Write'));
$this->template->set_var('lang_download',lang('Download'));
!
$this->template->set_var('src_file',$this->bo->src_file);
!
if(!$this->bo->loaded_apps[$sourcelang]['writeable'])
{
!
$this->template->set_block('footer','srcwrite','srcwrite');
! $this->template->set_var('srcwrite','');
}
$this->template->set_var('tgt_file',$this->bo->tgt_file);
$this->template->set_var('targetlang',$targetlang);
!
if(!$this->bo->loaded_apps[$targetlang]['writeable'])
{
!
$this->template->set_block('footer','tgtwrite','tgtwrite');
! $this->template->set_var('srcwrite','');
}
+ $this->template->set_var('helpmsg',lang('!!!
You have to [Save] every manual change in the above fields, before you can go
to the next step !!!'));
$this->template->pfp('out','footer');
}
***************
*** 528,548 ****
/*!
@function htmlspecialchars
! @abstract converts/reverts a string converted by
htmlspecialchars() to its original form
@param $text
*/
function htmlspecialchars($text,$reverse=False)
{
- $from = array('>','<','"','&','[',']');
- $to =
array('>','<','"','&','%5B','%5D');
-
if (!$reverse)
{
! return str_replace($from,$to,$text);
}
else
{
! return str_replace($to,$from,$text);
!
}
}
--- 511,529 ----
/*!
@function htmlspecialchars
! @abstract converts / reverts a string, convert is similar to
htmlspecialchars(), but has to excape square brackets too
@param $text
*/
function htmlspecialchars($text,$reverse=False)
{
if (!$reverse)
{
! $ret =
str_replace(array('>','<','"','[',']','&'),array('>','<','"','%5B','%5D','&'),$text);
}
else
{
! $ret =
str_replace(array('%5B','%5D'),array('[',']'),$text);
}
+ //echo
"htmlspecialchars('$text'".($reverse?',reverse':'').")='$ret'<br>\n";
+ return $ret;
}
***************
*** 680,684 ****
function lang_option($app_name,$current,$name)
{
! $list = array(
$app_name => $app_name,
'common' => 'common',
--- 661,665 ----
function lang_option($app_name,$current,$name)
{
! $list = $this->bo->src_apps + array(
$app_name => $app_name,
'common' => 'common',
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: developer_tools/inc class.bolangfile.inc.php,1.8.2.2.2.1,1.8.2.2.2.2 class.solangfile.inc.php,1.9.2.4.2.2,1.9.2.4.2.3 class.uilangfile.inc.php,1.10.2.1.2.1,1.10.2.1.2.2,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: developer_tools/templates/default langfile.tpl,1.8.4.1,1.8.4.2 langmissing.tpl,1.1.4.1,1.1.4.2
- Next by Date:
[Phpgroupware-cvs] CVS: developer_tools/setup phpgw_de.lang,1.1.2.1.2.1,1.1.2.1.2.2 phpgw_en.lang,1.5.2.1.2.1,1.5.2.1.2.2
- Previous by thread:
[Phpgroupware-cvs] CVS: developer_tools/templates/default langfile.tpl,1.8.4.1,1.8.4.2 langmissing.tpl,1.1.4.1,1.1.4.2
- Next by thread:
[Phpgroupware-cvs] CVS: developer_tools/setup phpgw_de.lang,1.1.2.1.2.1,1.1.2.1.2.2 phpgw_en.lang,1.5.2.1.2.1,1.5.2.1.2.2
- Index(es):