Drupal Association members fund grants that make connections all over the world.
The basic functionality of the contributed Transliteration module has been added to Drupal Core.
The core/component transliteration classes do basic character-by-character transliteration using a database of generic character transliterations and language-specific overrides, which is OK for basic uses such as creating legal file names and machine names, but not good for transliterating prose (which would require consideration of context, capitalization, etc.).
To use this class from the Drupal container:
// Use the current default interface language. $langcode = Drupal::languageManager()->getLanguage()->langcode; // Instantiate the transliteration class. $trans = Drupal::service('transliteration'); // Use this to transliterate some text. $transformed = $trans->transliterate($string, $langcode); // Limit the result to $max characters, making sure to stop on an input // character boundary $transformed = $trans->transliterate($string, $langcode, $max);
Or you can instantiate the class directly:
use Drupal\Core\Transliteration\PHPTransliteration; $trans = new PHPTransliteration(); $transformed = $trans->transliterate($string, $langcode); // Or: $transformed = $trans->transliterate($string, $langcode, $max);
There is also a new hook that modules can implement to provide language-specific overrides of individual characters' transliterations: hook_transliteration_overrides_alter(). This hook is only invoked from the Core class, not the Component class (components are Drupalism-independent).