// the language addition, we need to inform the user on how to start
// a translation
if($onlylanguage){
$message=t('%locale language added. You can now import a translation. See the <a href="%locale-help">help screen</a> for more information.',array('%locale'=>'<em>'.t($name).'</em>','%locale-help'=>url('admin/help/locale')));
$message=t('%locale language added. You can now import a translation. See the <a href="%locale-help">help screen</a> for more information.',array('%locale'=>theme('placeholder',t($name)),'%locale-help'=>url('admin/help/locale')));
}
else{
$message=t('%locale language added.',array('%locale'=>'<em>'.t($name).'</em>'));
$message=t('%locale language added.',array('%locale'=>theme('placeholder',t($name))));
}
drupal_set_message($message);
watchdog('locale',t('%language language (%locale) added.',array('%language'=>"<em>$name</em>",'%locale'=>"<em>$code</em>")));
watchdog('locale',t('%language language (%locale) added.',array('%language'=>theme('placeholder',$name),'%locale'=>theme('placeholder',$code))));
}
/**
...
...
@@ -47,7 +47,7 @@ function _locale_admin_manage_screen() {
$status=db_fetch_object(db_query("SELECT isdefault, enabled FROM {locales_meta} WHERE locale = '%s'",$key));
watchdog('locale',t('Imported %file into %locale: %number new strings added and %update updated.',array('%file'=>"<em>$file->filename</em>",'%locale'=>"<em>$lang</em>",'%number'=>$additions,'%update'=>$updates)));
watchdog('locale',t('Imported %file into %locale: %number new strings added and %update updated.',array('%file'=>theme('placeholder',$file->filename),'%locale'=>theme('placeholder',$lang),'%number'=>$additions,'%update'=>$updates)));
returnTRUE;
}
...
...
@@ -269,9 +269,10 @@ function _locale_import_po($file, $lang, $mode) {
*/
function_locale_import_read_po($file){
$message=theme('placeholder',$file->filename);
$fd=fopen($file->filepath,"rb");
if(!$fd){
drupal_set_message(t('Translation import failed: file %filename cannot be read.',array('%filename'=>"<em>$file->filename</em>")),'error');
drupal_set_message(t('Translation import failed: file %filename cannot be read.',array('%filename'=>$message)),'error');
returnFALSE;
}
$info=fstat($fd);
...
...
@@ -303,19 +304,19 @@ function _locale_import_read_po($file) {
$context="COMMENT";
}
else{// Parse error
drupal_set_message(t("Translation file %filename broken: expected 'msgstr' in line %line.",array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t("Translation file %filename broken: expected 'msgstr' in line %line.",array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
}
elseif(!strncmp("msgid_plural",$line,12)){
if($context!="MSGID"){// Must be plural form for current entry
drupal_set_message(t("Translation file %filename broken: unexpected 'msgid_plural' in line %line.",array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t("Translation file %filename broken: unexpected 'msgid_plural' in line %line.",array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$line=trim(substr($line,12));
$quoted=_locale_import_parse_quoted($line);
if($quoted===false){
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$current["msgid"]=$current["msgid"]."\0".$quoted;
...
...
@@ -327,13 +328,13 @@ function _locale_import_read_po($file) {
$current=array();
}
elseif($context=="MSGID"){// Already in this context? Parse error
drupal_set_message(t("Translation file %filename broken: unexpected 'msgid' in line %line.",array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t("Translation file %filename broken: unexpected 'msgid' in line %line.",array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$line=trim(substr($line,5));
$quoted=_locale_import_parse_quoted($line);
if($quoted===false){
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$current["msgid"]=$quoted;
...
...
@@ -341,11 +342,11 @@ function _locale_import_read_po($file) {
}
elseif(!strncmp("msgstr[",$line,7)){
if(($context!="MSGID")&&($context!="MSGID_PLURAL")&&($context!="MSGSTR_ARR")){// Must come after msgid, msgid_plural, or msgstr[]
drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr[]' in line %line.",array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr[]' in line %line.",array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
if(strpos($line,"]")===false){
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$frombracket=strstr($line,"[");
...
...
@@ -353,7 +354,7 @@ function _locale_import_read_po($file) {
$line=trim(strstr($line," "));
$quoted=_locale_import_parse_quoted($line);
if($quoted===false){
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$current["msgstr"][$plural]=$quoted;
...
...
@@ -361,13 +362,13 @@ function _locale_import_read_po($file) {
}
elseif(!strncmp("msgstr",$line,6)){
if($context!="MSGID"){// Should come just after a msgid block
drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr' in line %line.",array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr' in line %line.",array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$line=trim(substr($line,6));
$quoted=_locale_import_parse_quoted($line);
if($quoted===false){
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
$current["msgstr"]=$quoted;
...
...
@@ -376,7 +377,7 @@ function _locale_import_read_po($file) {
elseif($line!=""){
$quoted=_locale_import_parse_quoted($line);
if($quoted===false){
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: syntax error in line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
@@ -389,7 +390,7 @@ function _locale_import_read_po($file) {
$current["msgstr"][$plural].=$quoted;
}
else{
drupal_set_message(t('Translation file %filename broken: unexpected string in line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: unexpected string in line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
}
...
...
@@ -400,7 +401,7 @@ function _locale_import_read_po($file) {
$strings[$current["msgid"]]=$current;
}
elseif($context!="COMMENT"){
drupal_set_message(t('Translation file %filename broken: unexpected end file at line %line.',array('%filename'=>"<em>$file->filename</em>",'%line'=>$lineno)),'error');
drupal_set_message(t('Translation file %filename broken: unexpected end of file at line %line.',array('%filename'=>$message,'%line'=>$lineno)),'error');
returnFALSE;
}
...
...
@@ -465,7 +466,7 @@ function _locale_import_parse_plural_forms($pluralforms, $filename) {
returnarray($nplurals,$plural);
}
else{
drupal_set_message(t("Translation file %filename broken: plural formula couldn't get parsed.",array('%filename'=>"<em>$filename</em>")),'error');
drupal_set_message(t("Translation file %filename broken: plural formula couldn't get parsed.",array('%filename'=>theme('placeholder',$filename))),'error');
returnFALSE;
}
}
...
...
@@ -768,7 +769,7 @@ function _locale_export_po($language) {