Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
AppleInfoPlistFfs.php
1<?php
2
19 public static function readRow( $line ) {
20 $match = [];
21 // InfoPList file does not use quoted keys, allows only basic characters without spaces
22 // as keys.
23 if ( preg_match( '/([A-Za-z ]*)\s*=\s*"((?:\\\"|[^"])*)"\s*;\s*$/', $line, $match ) ) {
24 // trimming to allow beginning and ending spaces but these will be removed
25 // during exports.
26 $key = parent::unescapeString( trim( $match[1] ) );
27 $value = parent::unescapeString( $match[2] );
28
29 if ( $key === '' ) {
30 throw new RuntimeException( "Empty or invalid key in line: $line" );
31 }
32
33 if ( strpos( $key, ' ' ) !== false ) {
34 throw new RuntimeException( "Key with space found in line: $line" );
35 }
36
37 return [ $key, $value ];
38 } else {
39 throw new RuntimeException( "Unrecognized line format: $line." );
40 }
41 }
42
49 public static function writeRow( $key, $value ) {
50 return $key . ' = ' . parent::quoteString( $value ) . ';' . "\n";
51 }
52}
AppleFFS class implements support for Apple .strings files.
Definition AppleFFS.php:17
AppleInfoPlistFfs extends the AppleFFS class and implements support for Apple InfoPlist ....
static writeRow( $key, $value)
Writes well-formed properties file row with key and value.
static readRow( $line)
Parses non-empty strings file row to key and value.