Skip to content

Commit f5dc79c

Browse files
T3RAN13T3RAN13
authored andcommitted
Transliterator fix
1 parent 5fae632 commit f5dc79c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Tools/Transliterator.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Transliterator
2020
'ё' => 'yo',
2121
'э' => 'ye',
2222
'ю' => 'yu',
23+
'я' => 'ya',
2324
'х' => 'kh',
2425
'ж' => 'zh',
2526
'а' => 'a',
@@ -102,8 +103,8 @@ public static function encode($str, $fromLang)
102103
return $str;
103104
}
104105

105-
$s = '[^[\]]+(?=])';
106-
$t = '<(.|\n)*?>';
106+
$s = '/[^[\]]+(?=])/';
107+
$t = '/<(.|\n)*?>/';
107108
preg_match_all($s, $str, $orig, PREG_PATTERN_ORDER);
108109
preg_match_all($t, $str, $tags, PREG_PATTERN_ORDER);
109110

@@ -132,12 +133,12 @@ public static function decode($str, $toLang)
132133
}
133134
$str = substr($str, 4);
134135

135-
$s = '[^[\]]+(?=])';
136-
$t = '<(.|\n)*?>';
136+
$s = '/[^[\]]+(?=])/';
137+
$t = '/<(.|\n)*?>/';
137138
preg_match_all($s, $str, $orig, PREG_PATTERN_ORDER);
138139
preg_match_all($t, $str, $tags, PREG_PATTERN_ORDER);
139140

140-
$str = self::transliterate($str, $toLang);
141+
$str = self::transliterate($str, $toLang, true);
141142

142143
if (!empty($orig[0])) {
143144
self::restoreTechnicalData($str, $s, $orig);

0 commit comments

Comments
 (0)