PO::import_from_file() WordPress Method
The PO::import_from_file() Wordpress method is used to import a PO file into the WordPress database. This is useful for translating WordPress into another language.
PO::import_from_file( string $filename ) #
Parameters
- $filename
(string)(Required)
Return
(bool)
Source
File: wp-includes/pomo/po.php
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub