In the i18n world, Pseudo Loc Test is one of the early stage methods that gives some benefits.
- Detecting hard coded strings
- Testing flexibility of UI components like button labels
- Suitability of using multiple languages(include Asian languages) for fonts.
- Testing i18n related functions(if those are already developed) – Date formatter & number formatter
With the ECMAScript 6, we already have a good number of npm packages that we can simply install and initiate on our applications. Most of them support the Latin 1 & 2 character set, but not many packages support Asian characters and Latin Extended-A(0100-017F) all together.
So, here I simply create my own PL Test package – i18next-pseudoloc
By using the i18next-pseudoloc, developers can test Latin Extended-A & limited Korean/Japanese/Thai. Most Asian characters, I have picked above 2 bytes characters.
Install
$ npm i i18next-pseudoloc
Setting
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import PseudoLoc from 'i18next-pseudoloc';
...
i18n
.use(new PseudoLoc({
lengther:1,
enabled: true,
enableCJK: true,
sourceLocale: 'pt-BR', // pt-BR is only for PL Test
}))
.init({
postProcess: ["pseudoloc"],
...
How to ready Pseudo Loc string
<긇<[Ŷṓṵ āŗė ėňḡĩňėėŗ, ŧĥėň ĉĥėĉķṓṵŧ ŧĥė ŗėṗṓ ṓϝ ŧĥĩş āṗṗḽĩĉāŧĩṓň。]>ヲ>
- There are Latin character sentence opening and closing markers –
<[
and]>
- There are Korean/Japanese/Thai opening and closing markers with random characters –
<긇
andヲ>
- If the sentence has the
.
(period – fullstop), then it will be replaced with Japanese period –。
- If the sentence has the
?
, then it will be replaced with Spanish inverted mark of interrogation –¿
- If the sentence has the
“
,(opening quotation), then it will be replaced with the German opening quotation –„
- So, if you see
<<[
or]>>
, this indicates the font in a product is not supporting Asian characters(even the fallback is failing).
In the modern web, with the rise of Google Font, most modern websites support a wide range of Unicode and have well-implemented glyph fallback mechanisms. However, there are still systems that do not support fonts for specific languages. For instance, mobile phone operating systems built for a limited market may not include an entire font set for non-target market languages. Therefore, the importance of performing PL (language) tests in the early stages of i18n is still significant.