Parametri

$f

(risorsa)(Richiesto)

$lineno

(int)(Richiesto)

Ritorno

(null|false|array)

Fonte

File: wp-includes/pomo/po.php

functionread_entry($f,$lineno=0){$entry=newTranslation_Entry();// Where were we in the last step.// Can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural.$context='';$msgstr_index=0;while(true){$lineno++;$line=PO::read_line($f);if(!$line){if(feof($f)){if(self::is_final($context)){break;}elseif(!$context){// We haven't read a line and EOF came.returnnull;}else{returnfalse;}}else{returnfalse;}}if("n"===$line){continue;}$line=trim($line);if(preg_match('/^#/',$line,$m)){// The comment is the start of a new entry.if(self::is_final($context)){PO::read_line($f,'put-back');$lineno--;break;}// Comments have to be at the beginning.if($context&&'comment'!==$context){returnfalse;}// Add comment.$this->add_comment_to_entry($entry,$line);}elseif(preg_match('/^msgctxts+(".*")/',$line,$m)){if(self::is_final($context)){PO::read_line($f,'put-back');$lineno--;break;}if($context&&'comment'!==$context){returnfalse;}$context='msgctxt';$entry->context.=PO::unpoify($m[1]);}elseif(preg_match('/^msgids+(".*")/',$line,$m)){if(self::is_final($context)){PO::read_line($f,'put-back');$lineno--;break;}if($context&&'msgctxt'!==$context&&'comment'!==$context){returnfalse;}$context='msgid';$entry->singular.=PO::unpoify($m[1]);}elseif(preg_match('/^msgid_plurals+(".*")/',$line,$m)){if('msgid'!==$context){returnfalse;}$context='msgid_plural';$entry->is_plural=true;$entry->plural.=PO::unpoify($m[1]);}elseif(preg_match('/^msgstrs+(".*")/',$line,$m)){if('msgid'!==$context){returnfalse;}$context='msgstr';$entry->translations=array(PO::unpoify($m[1]));}elseif(preg_match('/^msgstr[(d+)]s+(".*")/',$line,$m)){if('msgid_plural'!==$context&&'msgstr_plural'!==$context){returnfalse;}$context='msgstr_plural';$msgstr_index=$m[1];$entry->translations[$m[1]]=PO::unpoify($m[2]);}elseif(preg_match('/^".*"$/',$line)){$unpoified=PO::unpoify($line);switch($context){case'msgid':$entry->singular.=$unpoified;break;case'msgctxt':$entry->context.=$unpoified;break;case'msgid_plural':$entry->plural.=$unpoified;break;case'msgstr':$entry->translations[0].=$unpoified;break;case'msgstr_plural':$entry->translations[$msgstr_index].=$unpoified;break;default:returnfalse;}}else{returnfalse;}}$have_translations=false;foreach($entry->translationsas$t){if($t||('0'===$t)){$have_translations=true;break;}}if(false===$have_translations){$entry->translations=array();}returnarray('entry'=>$entry,'lineno'=>$lineno,);}

Correlato

Utilizzi

Usi Descrizione
wp-includes/pomo/po.php: PO::is_final()

Funzione di aiuto per read_entry

wp-includes/pomo/entry.php: Traduzione_Ingresso::__costruzione()
wp-includes/pomo/po.php: PO::read_line()
wp-includes/pomo/po.php: PO::add_comment_to_entry()
wp-includes/pomo/po.php: PO::unpoify()

Restituisce la stringa originale da una stringa formattata in PO

Utilizzato da

Usato da Descrizione
wp-includes/pomo/po.php: PO::import_from_file()