]> git.mjollnir.org Git - s9y.git/commitdiff
allow the definition of replacement chars for the URL on a per-language basis
authorgarvinhicking <garvinhicking>
Sun, 3 Jul 2005 09:51:17 +0000 (09:51 +0000)
committergarvinhicking <garvinhicking>
Sun, 3 Jul 2005 09:51:17 +0000 (09:51 +0000)
docs/NEWS
include/functions_permalinks.inc.php
lang/serendipity_lang_ru.inc.php

index c74e631f74c1b89115c60222027d2dea65548324..ee728be43d4d709b0b52f94606d3f2a857975cde 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,11 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Allow language files to define $i18n_filename_from and _to array
+      so that each language can individually rewrite URL characters.
+      Only the Russian language currently makes use of this.
+      (garvinhicking)
+
     * fixed serendipity_traversePath() -  PHP5 issue with array_merge()
       Thanks to jdhawk for the fix (flotsam)
 
index 238bac97104426d8ccdb12bc06a07681269d9048..b2ed4f7e3990393079bf01c6742ea00d1645cf90 100644 (file)
@@ -89,8 +89,14 @@ function serendipity_makeFilename($str) {
 
                      'y');
 
-    // Replace international chars not detected by every locale
-    $str = str_replace($from, $to, $str);
+    if (isset($GLOBALS['i18n_filename_from'])) {
+        // Replace international chars not detected by every locale.
+        // The array of chars is defined in the language file.
+        $str = str_replace($GLOBALS['i18n_filename_from'], $GLOBALS['i18n_filename_to'], $str);
+    } else {
+        // Replace international chars not detected by every locale
+        $str = str_replace($from, $to, $str);
+    }
 
     // Nuke chars not allowed in our URI
     $str = preg_replace('#[^' . PAT_FILENAME . ']#i', '', $str);
index f1508e34a0377976dbcb5663ec99c309f98067e8..042f7bbb97e72d71d482532c1a89f4664ad50ca9 100644 (file)
@@ -11,6 +11,8 @@
 @define('NUMBER_FORMAT_DECPOINT', '.');
 @define('NUMBER_FORMAT_THOUSANDS', ', ');
 @define('LANG_DIRECTION', 'ltr');
+$i18n_filename_from = array(' ', 'а', 'А', 'б', 'Б', 'в', 'В', 'г', 'Г', 'д', 'Д', 'е', 'Е', 'ё', 'Ё', 'Ж', 'ж', 'з', 'З', 'и', 'И', 'й', 'Й', 'к', 'К', 'л', 'Л', 'м', 'М', 'н', 'Н', 'о', 'О', 'п', 'П', 'р','Р', 'с', 'С', 'т', 'Т', 'у', 'У', 'ф', 'Ф', 'х', 'Х', 'ц', 'Ц', 'ч', 'Ч', 'ш', 'Ш', 'щ', 'Щ', 'ъ', 'Ъ', 'ы', 'Ы', 'ь', 'Ь', 'э', 'Э', 'ю', 'Ю', 'Я', 'я');
+$i18n_filename_to   = array('_', 'a', 'A', 'b', 'B', 'v', 'V', 'g', 'G', 'd', 'D', 'e', 'E', 'jo', 'Jo', 'zh', 'Zh', 'z', 'Z', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'f', 'F', 'h', 'H', 'c', 'C', 'ch', 'Ch', 'sh', 'Sh', 'w', 'W', '#', '#', 'y', 'Y', '’', '’', 'je', 'Je', 'ju', 'Ju', 'ja', 'Ja');
 
 @define('SERENDIPITY_ADMIN_SUITE', 'Администрирование Serendipity');
 @define('HAVE_TO_BE_LOGGED_ON', 'Вы должны войти под каким-нибудь пользователем, чтобы иметь доступ к этой странице');