PHP Classes

Cyrillic to Latin: Translite text between cyrillic and latin

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 55%Total: 1,990 All time: 1,977 This week: 673Up
Version License Categories
cyrlat 1.0FreewareLocalization, Text processing, Conver...
Description 

Author

This is a simple class can convert text between representations using cyrillic and latin character sets.

The class can convert text in both directions: cyrillic to latin and latin to cyrillic.

Picture of Yaroslav Shapoval
Name: Yaroslav Shapoval <contact>
Classes: 1 package by
Country: Belarus Belarus
Age: 40
All time rank: 15144 in Belarus Belarus
Week rank: 128 Up1 in Belarus Belarus Up

Details

INTRO This class *Cyrillic to Latin (translit)* provides methods for converting (translitering) symbols. License: FREEWARE (please, leave my copyright!). What you need to work with this class: No additional extensions/pears/pecls needed. functions: string cyr2lat(input string) - cyrillic to latin convert string lat2cyr(input string) - latin to cyrillic convert variables: array $cyr - cyrillic symbols array $lat - latin replacement for cyrillic symbols array $lat_additional - additional latin symbols set (for non-usuall replacements) array $cyr_additional - additional cyrillic symbols (to replace non-usuall latin symbol replacements) BUGS Known bugs and _undocumented features_: + Work only with Windows-1251 codepage. If you want use it with koi8-r or other, use php-standard function convert_cyr_string(...) on your input, like <code> #... $input=convert_cyr_string($input, "k", "w"); //convert from KOI8-R to Windows-1251 #... </code> + Some symbolsets have wrong translitering (by their dual nature). For example: "Shoroh" is "Шорох" and "Shvatka" is "Шватка" (not "Схватка"). Bugfix: manual editing of outputed string :) # Слижком уж он велик и могуч, этот Русский язык. Всё алгоритмом не опишешь. + Class represent my own vision of translit rules. If you want "Jopa" instead of "Zhopa" - edit $cyr and $lat (!notice) symbols order matters in arrays $cyr, $lat, $cyr_additional, $lat_additional! USAGE The usage is rather simple: <code> #------->8------test.php------------ <?php require_once("cyrlat.class.php");// include main class $text=new CyrLat; // initialize $text as $input="Привет, Мир!"; echo $text->cyr2lat($input); echo "<hr>\n"; $input="Privet, Mir!"; echo $text->lat2cyr($input); ?> #-------8<--------------------------- </code> See /examples/ for more examples. You can simply integrate it to forums, forms, sms-senders etc. Da pribudet s vami Sila!

  Files folder image Files (12)  
File Role Description
Files folder imageexamples (3 files, 1 directory)
Plain text file cyrlat.class.php Class main class
Accessible without login Plain text file readme.txt Doc. English readme text
Accessible without login Plain text file test.php Example main classsymple example

  Files folder image Files (12)  /  examples  
File Role Description
Files folder imageAjaxTest (3 files, 1 directory)
  Accessible without login Plain text file cyr2lat_test.php Example cyrillic to latin symbols test
  Accessible without login Plain text file forms_test.php Example usage example with forms
  Accessible without login Plain text file lat2cyr_test.php Example latin to cyrillic symbols test

  Files folder image Files (12)  /  examples  /  AjaxTest  
File Role Description
Files folder imagelib (3 files)
  Accessible without login Plain text file testAjax.php Example Ajax test script
  Accessible without login Plain text file lat2cyr.php Appl. loader
  Accessible without login Plain text file readme.txt Doc. Ajax test script

  Files folder image Files (12)  /  examples  /  AjaxTest  /  lib  
File Role Description
  Accessible without login Plain text file config.php Conf. Ajax config file
  Accessible without login Plain text file Js.js Aux. Ajax JS file
  Accessible without login Plain text file php.php Aux. Ajax server

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,990
This week:0
All time:1,977
This week:673Up
User Ratings User Comments (2)
 All time
Utility:62%StarStarStarStar
Consistency:62%StarStarStarStar
Documentation:87%StarStarStarStarStar
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:55%StarStarStar
Rank:2000
 
Excellent
15 years ago (kishore kumar)
80%StarStarStarStarStar
Which character encoding is assumed? I am having trouble maki...
17 years ago (Judith Meyer)
55%StarStarStar