Lingua::Translit(3)

πŸ’– Lingua::Translit β€” the Lingua::Translit(3) era πŸ’–

okay so bestie, welcome to Lingua::Translit β€” the Perl module that literally moves your text from one writing system to another, no cap. This page is from the User Contributed Perl Documentation section, and it's about to be your new obsession. πŸ¦‹


✨ NAME ✨

Lingua::Translit β€” transliterates text between writing systems. that's it, that's the vibe. πŸ’…


✨ SYNOPSIS ✨

the whole thing in four lines, iconic:

use Lingua::Translit;

my $tr = new Lingua::Translit("ISO 843");

my $text_tr = $tr->translit("character oriented string");

if ($tr->can_reverse()) {
  $text_tr = $tr->translit_reverse("character oriented string");
}

like… look at her go. πŸŽ€


✨ DESCRIPTION ✨

Lingua::Translit converts text from one writing system to another, based on national or international transliteration tables. and where it's possible? reverse transliteration is supported too. slay. πŸ”₯

so the term "transliteration" describes converting text from one writing system or alphabet to another one. ideally the conversion is unique β€” one character maps to exactly one character β€” so the original spelling can be reconstructed. that's the dream, honestly. practically though? not always the case, and one single letter of the original alphabet can get transcribed as two, three or even more letters. it's giving overachiever. 😭

also important: there's more than one transliteration scheme for the same writing system. so it's important and necessary info to know which scheme will be / has been used to transliterate a text β€” that's how you work integratively and actually reconstruct the original data. iykyk. πŸ’œ

now, reconstruction is a whole problem for non-unique transliterations when there's no language-specific knowledge available, because the resulting clusters of letters can be ambiguous. example time, bestie: the Greek character "PSI" maps to "ps", but "ps" could also come from the sequence "PI", "SIGMA" β€” since "PI" maps to "p" and "SIGMA" maps to s. so if a transliteration table leads to ambiguous conversions, that table cannot be used reverse. periodt. πŸ’€

otherwise the table can be used in both directions, if appreciated. so if ISO 9 was originally created to convert Cyrillic letters to the Latin alphabet, the reverse transliteration will transform Latin letters to Cyrillic. main character energy, both ways. πŸ‘‘


✨ METHODS ✨

🌸 new("name of table")

initializes an object with the specific transliteration table, e.g. "ISO 9". basically you're picking your fighter. 🫢

🌸 translit("character oriented string")

transliterates the given text according to the object's transliteration table. returns the transliterated text. ate. πŸ’…

🌸 translit_reverse("character oriented string")

transliterates the given text according to the object's transliteration table, but uses it the other way round. for example, table ISO 9 is a transliteration scheme for converting Cyrillic letters to the Latin alphabet β€” so if used reverse, Latin letters will be mapped to Cyrillic ones. πŸ”„

returns the transliterated text. πŸ’–

🌸 can_reverse()

returns true (1), iff reverse transliteration is possible. false (0) otherwise. a little vibe check for your table. βœ…

🌸 name()

returns the name of the chosen transliteration table, e.g. "ISO 9". 🏷️

🌸 desc()

returns a description for the transliteration, e.g. "ISO 9:1995, Cyrillic to Latin". the lore. πŸ“œ


✨ SUPPORTED TRANSLITERATIONS ✨

πŸ’œ Cyrillic

  • ALA-LC RUS β€” not reversible, ALA-LC:1997, Cyrillic to Latin, Russian
  • ISO 9 β€” reversible, ISO 9:1995, Cyrillic to Latin
  • ISO/R 9 β€” reversible, ISO 9:1954, Cyrillic to Latin
  • DIN 1460 RUS β€” reversible, DIN 1460:1982, Cyrillic to Latin, Russian
  • DIN 1460 UKR β€” reversible, DIN 1460:1982, Cyrillic to Latin, Ukrainian
  • DIN 1460 BUL β€” reversible, DIN 1460:1982, Cyrillic to Latin, Bulgarian
  • Streamlined System BUL β€” not reversible, The Streamlined System: 2006, Cyrillic to Latin, Bulgarian
  • GOST 7.79 RUS β€” reversible, GOST 7.79:2000 (table B), Cyrillic to Latin, Russian
  • GOST 7.79 RUS OLD β€” not reversible, GOST 7.79:2000 (table B), Cyrillic to Latin with support for Old Russian (pre 1918), Russian
  • GOST 7.79 UKR β€” reversible, GOST 7.79:2000 (table B), Cyrillic to Latin, Ukrainian
  • BGN/PCGN RUS Standard β€” not reversible, BGN/PCGN:1947 (Standard Variant), Cyrillic to Latin, Russian
  • BGN/PCGN RUS Strict β€” not reversible, BGN/PCGN:1947 (Strict Variant), Cyrillic to Latin, Russian

πŸ’œ Greek

  • ISO 843 β€” not reversible, ISO 843:1997, Greek to Latin
  • DIN 31634 β€” not reversible, DIN 31634:1982, Greek to Latin
  • Greeklish β€” not reversible, Greeklish (Phonetic), Greek to Latin

πŸ’œ Latin

  • Common CES β€” not reversible, Czech without diacritics
  • Common DEU β€” not reversible, German without umlauts
  • Common POL β€” not reversible, Unaccented Polish
  • Common RON β€” not reversible, Romanian without diacritics as commonly used
  • Common SLK β€” not reversible, Slovak without diacritics
  • Common SLV β€” not reversible, Slovenian without diacritics
  • ISO 8859-16 RON β€” reversible, Romanian with appropriate diacritics

πŸ’œ Arabic

  • Common ARA β€” not reversible, Common Romanization of Arabic

πŸ’œ Sanskrit

  • IAST Devanagari β€” not reversible, IAST Romanization to DevanāgarΔ«
  • Devanagari IAST β€” not reversible, DevanāgarΔ« to IAST Romanization

✨ ADDING NEW TRANSLITERATIONS ✨

so you wanna add your own transliteration tables to Lingua::Translit? obsessed. πŸ’– go look at the developer documentation at <https://www.netzum-sorglos.de/software/lingua-translit/developer-documentation.html>.

there's also a template of a transliteration table provided β€” xml/template.xml β€” so you can easily start developing. cute little starter pack. πŸŽ€


✨ RESTRICTIONS ✨

Lingua::Translit is suited to handle Unicode and utilizes comparisons and regular expressions that rely on code points. therefore any input is supposed to be character oriented ("use utf8;", ...) instead of byte oriented. ⚠️

however, if your data is byte oriented, be sure to pass it UTF-8 encoded to translit() and/or translit_reverse() β€” it will be converted internally. the module's got you. 🫢


✨ BUGS ✨

None known. (a flawless queen. πŸ‘‘)

please report bugs using CPAN's request tracker at <https://rt.cpan.org/Public/Dist/Display.html?Name=Lingua-Translit>. πŸ’Œ


✨ SEE ALSO ✨


✨ CREDITS ✨

  • thanks to Dr. Daniel Eiwen, Romanisches Seminar, Universitaet Koeln for his help on Romanian transliteration. 🌸
  • thanks to Dmitry Smal and Rusar Publishing for contributing the "ALA-LC RUS" transliteration table.
  • thanks to Ahmed Elsheshtawy for his help implementing the "Common ARA" Arabic transliteration.
  • thanks to Dusan Vuckovic for contributing the "ISO/R 9" transliteration table.
  • thanks to Ștefan Suciu for contributing the "ISO 8859-16 RON" transliteration table.
  • thanks to Philip Kime for contributing the "IAST Devanagari" and "Devanagari IAST" transliteration tables.
  • thanks to Nikola LečiΔ‡ for contributing the "BGN/PCGN RUS Standard" and "BGN/PCGN RUS Strict" transliteration tables.

✨ AUTHORS ✨

  • Alex Linke <alinke@netzum-sorglos.de>
  • Rona Linke <rlinke@netzum-sorglos.de>

  • Copyright (C) 2007-2008 Alex Linke and Rona Linke
  • Copyright (C) 2009-2016 Lingua-Systems Software GmbH
  • Copyright (C) 2016-2017 Netzum Sorglos, Lingua-Systems Software GmbH
  • Copyright (C) 2017-2022 Netzum Sorglos Software GmbH

this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🫢


and that's the whole page, bestie β€” this one's perl v5.42.0, dated 2022-06-16, brought to you by the fine people behind Lingua::Translit(3). go forth and transliterate. πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from