PHP Classes

Cyrillic to Latin: Translite text between cyrillic and latin

Recommend this page to a friend!
  Info   View files View files (12)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 55%Total: 1,990 This week: 1All time: 1,975 This week: 560Up
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: 15134 in Belarus Belarus
Week rank: 416 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  
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  /  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  /  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  /  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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,990
This week:1
All time:1,975
This week:560Up
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:1959
 
Excellent
14 years ago (kishore kumar)
80%StarStarStarStarStar
Which character encoding is assumed? I am having trouble maki...
16 years ago (Judith Meyer)
55%StarStarStar