You are here

function countries_transliterate in Countries 8

Same name and namespace in other branches
  1. 7.2 countries.module \countries_transliterate()

Helper function to transliterate names.

This will integrate with the transliteration module if present, falling back to a reduced character list otherwise.

1 call to countries_transliterate()
countries_sort in ./countries.module
A helper uasort callback function to sort an array of countries or names.

File

./countries.module, line 639
Defines the field and entity information for countries.

Code

function countries_transliterate($word) {
  static $words = array();
  if (!isset($words[$word])) {
    if (function_exists('transliteration_get')) {
      $words[$word] = transliteration_get($word, '');
    }
    else {
      $words[$word] = str_replace(array(
        '€',
        'ƒ',
        'Š',
        'Ž',
        'š',
        'ž',
        'Ÿ',
        '¢',
        '¥',
        'µ',
        'À',
        'Á',
        'Â',
        'Ã',
        'Ä',
        'Å',
        'Ç',
        'È',
        'É',
        'Ê',
        'Ë',
        'Ì',
        'Í',
        'Î',
        'Ï',
        'Ñ',
        'Ò',
        'Ó',
        'Ô',
        'Õ',
        'Ö',
        'Ø',
        'Ù',
        'Ú',
        'Û',
        'Ü',
        'Ý',
        'à',
        'á',
        'â',
        'ã',
        'ä',
        'å',
        'ç',
        'è',
        'é',
        'ê',
        'ë',
        'ì',
        'í',
        'î',
        'ï',
        'ñ',
        'ò',
        'ó',
        'ô',
        'õ',
        'ö',
        'ø',
        'ù',
        'ú',
        'û',
        'ü',
        'ý',
        'ÿ',
        'Œ',
        'œ',
        'Æ',
        'Ð',
        'Þ',
        'ß',
        'æ',
        'ð',
        'þ',
      ), array(
        'E',
        'f',
        'S',
        'Z',
        's',
        'z',
        'Y',
        'c',
        'Y',
        'u',
        'A',
        'A',
        'A',
        'A',
        'A',
        'A',
        'C',
        'E',
        'E',
        'E',
        'E',
        'I',
        'I',
        'I',
        'I',
        'N',
        'O',
        'O',
        'O',
        'O',
        'O',
        'O',
        'U',
        'U',
        'U',
        'U',
        'Y',
        'a',
        'a',
        'a',
        'a',
        'a',
        'a',
        'c',
        'e',
        'e',
        'e',
        'e',
        'i',
        'i',
        'i',
        'i',
        'n',
        'o',
        'o',
        'o',
        'o',
        'o',
        'o',
        'u',
        'u',
        'u',
        'u',
        'y',
        'y',
        'OE',
        'oe',
        'AE',
        'DH',
        'TH',
        'ss',
        'ae',
        'dh',
        'th',
      ), $word);
    }
  }
  return $words[$word];
}