On this page
PO::import_from_file( string $filename ): bool
Parameters
$filenamestring Required
Return
bool
Source
File: wp-includes/pomo/po.php. View all references
public function import_from_file( $filename ) {
$f = fopen( $filename, 'r' );
if ( ! $f ) {
return false;
}
$lineno = 0;
while ( true ) {
$res = $this->read_entry( $f, $lineno );
if ( ! $res ) {
break;
}
if ( '' === $res['entry']->singular ) {
$this->set_headers( $this->make_headers( $res['entry']->translations[0] ) );
} else {
$this->add_entry( $res['entry'] );
}
}
PO::read_line( $f, 'clear' );
if ( false === $res ) {
return false;
}
if ( ! $this->headers && ! $this->entries ) {
return false;
}
return true;
}
Related
Uses
| Uses | Description |
|---|---|
| PO::read_entry() wp-includes/pomo/po.php | |
| PO::read_line() wp-includes/pomo/po.php |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/po/import_from_file