gameface-arabic-rtl
v0.1.0
Published
Library for Arabic language support in Coherent Gameface
Downloads
20
Readme
gameface-arabic-rtl
This is a helper function for Arabic language support in Coherent Gameface. Since it does not support Arabic out of the box at the moment.
Installation
npm i gameface-arabic-rtl
Example
Without gameface-arabic-rtl
With gameface-arabic-rtl
Dependencies
I use Abdulla Saeed's code. But had to manually rewrite it for ES5 due to the fact that on some platforms for the babel-loader, conversion to ES5 for node_modules is disabled.
Usage
gameface-arabic-rtl is declared as a Universal Module (UMD), meaning it can be used with all conventional Javascript module systems:
ES6
import { process } from 'gameface-arabic-rtl';
const text = 'مرحبا بالعالم';
const translateNumbers = true;
const convertedText = process(text, translateNumbers);
CommonJS
const GamefaceArabicRtl = require('gameface-arabic-rtl/dist/gameface-arabic-rtl.min.js');
const text = 'مرحبا بالعالم';
const translateNumbers = true;
const convertedText = process(text, translateNumbers);
RequireJS
require(['GamefaceArabicRtl'], (GamefaceArabicRtl) => {
const text = 'مرحبا بالعالم';
const translateNumbers = true;
const convertedText = process(text, translateNumbers);
});
HTML5 <script>
tag
<script src="gameface-arabic-rtl.min.js"></script>
<script>
const text = 'مرحبا بالعالم';
const translateNumbers = true;
const convertedText = process(text, translateNumbers);
</script>
Known issues
Since Coherent Gameface does not support OpenType GSUB Table lookup, the required glyphs must be present in the font. For example:
'ﺖ'.codePointAt(0); // must NOT return undefined
Script was tested on Tahoma font.