? pathauto_using_transliterate.patch
Index: INSTALL.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/INSTALL.txt,v
retrieving revision 1.2
diff -u -p -r1.2 INSTALL.txt
--- INSTALL.txt 28 Oct 2007 22:46:58 -0000 1.2
+++ INSTALL.txt 6 May 2008 22:42:29 -0000
@@ -14,14 +14,12 @@ sure "administer pathauto" is enabled th
**Transliteration support:
If you desire transliteration support in the creation of URLs (e.g. the
-replacement of À with A) then you will need to rename the file
-i18n-ascii.example.txt to i18n-ascii.txt
+replacement of Á with A) then you will need to install the Transliteration
+module, which can be found at http://drupal.org/project/transliteration
-You can then freely edit the i18n-ascii.txt without worrying that your changes
-will be over-written by upgrades of Pathauto.
-
-For details on how to transliterate any UTF8 character, please see the full
-i18n-ascii-fill.txt file information at http://drupal.org/node/185664
+Once you've installed and enabled the module, simply go to
+admin/build/path/pathauto and check the "Transliterate prior to creating alias"
+box and path aliases should now be transliterated automagically.
**Upgrading from previous versions:
If you are upgrading from Pathauto 5.x-1.x to 5.x-2.x (or 6.x-2.x) then you will
Index: i18n-ascii.example.txt
===================================================================
RCS file: i18n-ascii.example.txt
diff -N i18n-ascii.example.txt
--- i18n-ascii.example.txt 28 Oct 2007 22:46:58 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,565 +0,0 @@
-; global transliteration
-[default]
-À = "A"
-Á = "A"
-Â = "A"
-Ã = "A"
-Ä = "Ae"
-Å = "A"
-Æ = "A"
-Ā = "A"
-Ą = "A"
-Ă = "A"
-Ç = "C"
-Ć = "C"
-Č = "C"
-Ĉ = "C"
-Ċ = "C"
-Ď = "D"
-Đ = "D"
-È = "E"
-É = "E"
-Ê = "E"
-Ë = "E"
-Ē = "E"
-Ę = "E"
-Ě = "E"
-Ĕ = "E"
-Ė = "E"
-Ĝ = "G"
-Ğ = "G"
-Ġ = "G"
-Ģ = "G"
-Ĥ = "H"
-Ħ = "H"
-Ì = "I"
-Í = "I"
-Î = "I"
-Ï = "I"
-Ī = "I"
-Ĩ = "I"
-Ĭ = "I"
-Į = "I"
-İ = "I"
-IJ = "IJ"
-Ĵ = "J"
-Ķ = "K"
-Ľ = "K"
-Ĺ = "K"
-Ļ = "K"
-Ŀ = "K"
-Ł = "L"
-Ñ = "N"
-Ń = "N"
-Ň = "N"
-Ņ = "N"
-Ŋ = "N"
-Ò = "O"
-Ó = "O"
-Ô = "O"
-Õ = "O"
-Ö = "Oe"
-Ø = "O"
-Ō = "O"
-Ő = "O"
-Ŏ = "O"
-Œ = "OE"
-Ŕ = "R"
-Ř = "R"
-Ŗ = "R"
-Ś = "S"
-Ş = "S"
-Ŝ = "S"
-Ș = "S"
-Š = "S"
-Ť = "T"
-Ţ = "T"
-Ŧ = "T"
-Ț = "T"
-Ù = "U"
-Ú = "U"
-Û = "U"
-Ü = "Ue"
-Ū = "U"
-Ů = "U"
-Ű = "U"
-Ŭ = "U"
-Ũ = "U"
-Ų = "U"
-Ŵ = "W"
-Ŷ = "Y"
-Ÿ = "Y"
-Ý = "Y"
-Ź = "Z"
-Ż = "Z"
-Ž = "Z"
-à = "a"
-á = "a"
-â = "a"
-ã = "a"
-ä = "ae"
-ā = "a"
-ą = "a"
-ă = "a"
-å = "a"
-æ = "ae"
-ç = "c"
-ć = "c"
-č = "c"
-ĉ = "c"
-ċ = "c"
-ď = "d"
-đ = "d"
-è = "e"
-é = "e"
-ê = "e"
-ë = "e"
-ē = "e"
-ę = "e"
-ě = "e"
-ĕ = "e"
-ė = "e"
-ƒ = "f"
-ĝ = "g"
-ğ = "g"
-ġ = "g"
-ģ = "g"
-ĥ = "h"
-ħ = "h"
-ì = "i"
-í = "i"
-î = "i"
-ï = "i"
-ī = "i"
-ĩ = "i"
-ĭ = "i"
-į = "i"
-ı = "i"
-ij = "ij"
-ĵ = "j"
-ķ = "k"
-ĸ = "k"
-ł = "l"
-ľ = "l"
-ĺ = "l"
-ļ = "l"
-ŀ = "l"
-ñ = "n"
-ń = "n"
-ň = "n"
-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= "e"
-ἓ = "e"
-ἔ = "e"
-ἕ = "e"
-ὲ = "e"
-έ = "e"
-ζ = "z"
-η = "i"
-ή = "i"
-ἠ = "i"
-ἡ = "i"
-ἢ = "i"
-ἣ = "i"
-ἤ = "i"
-ἥ = "i"
-ἦ = "i"
-ἧ = "i"
-ᾐ = "i"
-ᾑ = "i"
-ᾒ = "i"
-ᾓ = "i"
-ᾔ = "i"
-ᾕ = "i"
-ᾖ = "i"
-ᾗ = "i"
-ὴ = "i"
-ή = "i"
-ῂ = "i"
-ῃ = "i"
-ῄ = "i"
-ῆ = "i"
-ῇ = "i"
-θ = "th"
-ι = "i"
-ί = "i"
-ϊ = "i"
-ΐ = "i"
-ἰ = "i"
-ἱ = "i"
-ἲ = "i"
-ἳ = "i"
-ἴ = "i"
-ἵ = "i"
-ἶ = "i"
-ἷ = "i"
-ὶ = "i"
-ί = "i"
-ῐ = "i"
-ῑ = "i"
-ῒ = "i"
-ΐ = "i"
-ῖ = "i"
-ῗ = "i"
-κ = "k"
-λ = "l"
-μ = "m"
-ν = "n"
-ξ = "ks"
-ο = "o"
-ό = "o"
-ὀ = "o"
-ὁ = "o"
-ὂ = "o"
-ὃ = "o"
-ὄ = "o"
-ὅ = "o"
-ὸ = "o"
-ό = "o"
-π = "p"
-ρ = "r"
-ῤ = "r"
-ῥ = "r"
-σ = "s"
-ς = "s"
-τ = "t"
-υ = "y"
-ύ = "y"
-ϋ = "y"
-ΰ = "y"
-ὐ = "y"
-ὑ = "y"
-ὒ = "y"
-ὓ = "y"
-ὔ = "y"
-ὕ = "y"
-ὖ = "y"
-ὗ = "y"
-ὺ = "y"
-ύ = "y"
-ῠ = "y"
-ῡ = "y"
-ῢ = "y"
-ΰ = "y"
-ῦ = "y"
-ῧ = "y"
-φ = "f"
-χ = "x"
-ψ = "ps"
-ω = "o"
-ώ = "o"
-ὠ = "o"
-ὡ = "o"
-ὢ = "o"
-ὣ = "o"
-ὤ = "o"
-ὥ = "o"
-ὦ = "o"
-ὧ = "o"
-ᾠ = "o"
-ᾡ = "o"
-ᾢ = "o"
-ᾣ = "o"
-ᾤ = "o"
-ᾥ = "o"
-ᾦ = "o"
-ᾧ = "o"
-ὼ = "o"
-ώ = "o"
-ῲ = "o"
-ῳ = "o"
-ῴ = "o"
-ῶ = "o"
-ῷ = "o"
-¨ = ""
-΅ = ""
-᾿ = ""
-῾ = ""
-῍ = ""
-῝ = ""
-῎ = ""
-῞ = ""
-῏ = ""
-῟ = ""
-῀ = ""
-῁ = ""
-΄ = ""
-΅ = ""
-` = ""
-῭ = ""
-ͺ = ""
-᾽ = ""
-А = "A"
-Б = "B"
-В = "V"
-Г = "G"
-Д = "D"
-Е = "E"
-Ё = "E"
-Ж = "ZH"
-З = "Z"
-И = "I"
-Й = "I"
-К = "K"
-Л = "L"
-М = "M"
-Н = "N"
-О = "O"
-П = "P"
-Р = "R"
-С = "S"
-Т = "T"
-У = "U"
-Ф = "F"
-Х = "KH"
-Ц = "TS"
-Ч = "CH"
-Ш = "SH"
-Щ = "SHCH"
-Ы = "Y"
-Э = "E"
-Ю = "YU"
-Я = "YA"
-а = "A"
-б = "B"
-в = "V"
-г = "G"
-д = "D"
-е = "E"
-ё = "E"
-ж = "ZH"
-з = "Z"
-и = "I"
-й = "I"
-к = "K"
-л = "L"
-м = "M"
-н = "N"
-о = "O"
-п = "P"
-р = "R"
-с = "S"
-т = "T"
-у = "U"
-ф = "F"
-х = "KH"
-ц = "TS"
-ч = "CH"
-ш = "SH"
-щ = "SHCH"
-ы = "Y"
-э = "E"
-ю = "YU"
-я = "YA"
-Ъ = ""
-ъ = ""
-Ь = ""
-ь = ""
-
-ð = "d"
-Ð = "D"
-þ = "th"
-Þ = "TH"
-
Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.30
diff -u -p -r1.30 pathauto.inc
--- pathauto.inc 4 May 2008 21:47:17 -0000 1.30
+++ pathauto.inc 6 May 2008 22:42:30 -0000
@@ -136,20 +136,9 @@ function pathauto_cleanstring($string, $
$output = str_replace('/', '', $output);
}
- // Optionally remove accents and transliterate
+ // Optionally transliterate (by running through the Transliterate module)
if (variable_get('pathauto_transliterate', FALSE)) {
-
- static $i18n_loaded = false;
- static $translations = array();
- if (!$i18n_loaded) {
- $path = drupal_get_path('module', 'pathauto');
- if (is_file($path .'/i18n-ascii.txt')) {
- $translations = parse_ini_file($path. '/i18n-ascii.txt');
- }
- $i18n_loaded = true;
- }
-
- $output = strtr($output, $translations);
+ $output = transliteration_get($output);
}
// Reduce to the subset of ASCII96 letters and numbers
Index: pathauto.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v
retrieving revision 1.103
diff -u -p -r1.103 pathauto.module
--- pathauto.module 4 May 2008 22:05:53 -0000 1.103
+++ pathauto.module 6 May 2008 22:42:30 -0000
@@ -175,10 +175,10 @@ function pathauto_admin_settings() {
$disable_transliteration = TRUE;
$disable_text = '';
$path = drupal_get_path('module', 'pathauto');
- $transliteration_help = t('When a pattern includes certain characters (such as those with accents) should Pathauto attempt to transliterate them into the ASCII-96 alphabet? Transliteration is determined by the i18n-ascii.txt file in the Pathauto directory. This option is disabled on your site because you do not have an i18n-ascii.txt file in the Pathauto directory.');
- if (is_file($path .'/i18n-ascii.txt')) {
+ $transliteration_help = t("When a pattern includes certain characters (such as those with accents) should Pathauto attempt to transliterate them into the ASCII-96 alphabet? Transliteration is handled by the Transliteration module. This option is disabled on your site because the Translation module either isn't installed, or isn't installed properly.");
+ if (module_exists('transliteration')) {
$disable_transliteration = FALSE;
- $transliteration_help = t('When a pattern includes certain characters (such as those with accents) should Pathauto attempt to transliterate them into the ASCII-96 alphabet? Transliteration is determined by the i18n-ascii.txt file in the Pathauto directory.');
+ $transliteration_help = t('When a pattern includes certain characters (such as those with accents) should Pathauto attempt to transliterate them into the ASCII-96 alphabet? Transliteration is handled by the Transliteration module.');
}
else {
// Perhaps they've removed the file, set the transliterate option to FALSE