Thursday, January 29. 2009
Thaana conversions class for PHP 5 - v0.4
Here is a major update to the Thaana Conversions class for PHP 5 that I have been maintaining. This new version adds two new functions convertLatinToAscii() and its counterpart convertAsciiToLatin(), which transliterates text to and from the latinized/romanized Thaana form. That means you can pass on text bits like "miadhakee reethi dhuvahekeve" and have it converted to "މިއަދަކީ ރީތި ދުވަހެކެވެ".
This feature would facilitate Thaana websites to add cool and interesting new features like, say, offering to display a news article in latinized Thaana if the user does not have the required fonts installed and/or cannot install the Thaana fonts!
- convertUtf8ToAscii()
- convertUtf8ToEntities()
- convertEntitiesToUnicodeIntegers()
- convertEntitiesToUtf8
- convertEntitiesToAscii()
- convertUnicodeIntegersToUtf8()
- convertUnicodeIntegersToEntities()
- convertUnicodeIntegersToAscii()
- convertAsciiToUtf8()
- convertAsciiToEntities()
- convertAsciiToUnicodeIntegers()
- convertLatinToAscii()
- convertAsciiToLatin()
Enjoy
This feature would facilitate Thaana websites to add cool and interesting new features like, say, offering to display a news article in latinized Thaana if the user does not have the required fonts installed and/or cannot install the Thaana fonts!
Info
The Thaana Conversions class for PHP provides a number of useful functions for the conversion and transliteration of text between various Thaana representation formats.Functions exposed
- convertUtf8ToUnicodeIntegers()- convertUtf8ToAscii()
- convertUtf8ToEntities()
- convertEntitiesToUnicodeIntegers()
- convertEntitiesToUtf8
- convertEntitiesToAscii()
- convertUnicodeIntegersToUtf8()
- convertUnicodeIntegersToEntities()
- convertUnicodeIntegersToAscii()
- convertAsciiToUtf8()
- convertAsciiToEntities()
- convertAsciiToUnicodeIntegers()
- convertLatinToAscii()
- convertAsciiToLatin()
Requirements
PHP 5License
This script is released under the Open Source MIT License, allowing its use in both personal and commercial applications as long as the copyright and license permission notice remains intact.Usage
<?php // Load the class require 'thaana_conversions.obj.php'; // Initialize the Thaana object $thaana = new Thaana_Conversions(); // Example: Converting latin to ascii echo $thaana->convertLatinToAscii('miadhakee haadha reethi dhuvahekeve.'); // Example: Converting ascii to latin echo $thaana->convertAsciiToLatin('miawdwkI hWdw rIti duvwhekeve.'); ?>
Download
- Thaana_Conversions.zip (v0.4, 4.8KB)Enjoy