I18N_Arabic

# Procedural File: KeySwap.php

Source Location: /Arabic/KeySwap.php

## Classes:

I18N_Arabic_KeySwap
  This PHP class convert keyboard language programmatically (English - Arabic)

## Page Details:

----------------------------------------------------------------------

Copyright (c) 2006-2016 Khaled Al-Sham'aa

http://www.ar-php.org

PHP Version 5

----------------------------------------------------------------------

LICENSE

This program is open source product; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.

----------------------------------------------------------------------

Class Name: Arabic Keyboard Swapping Language

Filename: KeySwap.php

Original Author(s): Khaled Al-Sham'aa <khaled@ar-php.org>

Purpose: Convert keyboard language programmatically (English - Arabic)

----------------------------------------------------------------------

Arabic Keyboard Swapping Language

PHP class to convert keyboard language between English and Arabic programmatically. This function can be helpful in dual language forms when users miss change keyboard language while they are entering data.

If you wrote an Arabic sentence while your keyboard stays in English mode by mistake, you will get a non-sense English text on your PC screen. In that case you can use this class to make a kind of magic conversion to swap that odd text by original Arabic sentence you meant when you type on your keyboard.

Please note that magic conversion in the opposite direction (if you type English sentences while your keyboard stays in Arabic mode) is also available in this class, but it is not reliable as much as previous case because in Arabic keyboard we have some keys provide a short-cut to type two chars in one click (those keys include: b, B, G and T).

Well, we try in this class to come over this issue by suppose that user used optimum way by using short-cut keys when available instead of assemble chars using stand alone keys, but if (s)he does not then you may have some typo chars in converted text.

Example:

1. include('./I18N/Arabic.php');
2. $obj = new I18N_Arabic('KeySwap');
4. $str = "Hpf lk hgkhs hglj'vtdkK Hpf hg`dk dldg,k f;gdjil Ygn ,p]hkdm ...";
6. echo "<p><u><i>Before:</i></u><br />$str<br /><br />";
8. $text = $obj->swapEa($str);
10. echo "<u><i>After:</i></u><br />$text<br /><br />";

#### Tags:

author: | Khaled Al-Sham'aa <khaled@ar-php.org>
copyright: | 2006-2016 Khaled Al-Sham'aa
link: | http://www.ar-php.org
filesource: | Source Code for this file
license: | LGPL

Documentation generated on Fri, 01 Jan 2016 10:26:05 +0200 by phpDocumentor 1.4.0