Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9c0a698

Browse filesBrowse files
author
alex-gorbunov
committed
Pseudo items have been added. Unit-tests were created.
git-svn-id: svn+ssh://svn.code.sf.net/p/i18nlib/code/branches/ilib4j@637 5ac057f5-ce63-4fb3-acd1-ab13b794ca36
1 parent a88fcfe commit 9c0a698
Copy full SHA for 9c0a698

File tree

Expand file treeCollapse file tree

4 files changed

+258
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+258
-5
lines changed
Open diff view settings
Collapse file

‎java/src/com/ilib/ResBundle.java‎

Copy file name to clipboardExpand all lines: java/src/com/ilib/ResBundle.java
+36-5Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,25 @@ protected void initPseudoMap()
208208
{
209209
pseudoMap = new LinkedHashMap<>();
210210

211+
StringBuilder script = new StringBuilder();
212+
switch(locale.getScript()) {
213+
case "Cyrl":
214+
script = script.append("zxx").append(File.separator).append("Cyrl").append(File.separator);
215+
break;
216+
case "Hans":
217+
script = script.append("zxx").append(File.separator).append("Hans").append(File.separator);
218+
break;
219+
case "Hebr":
220+
script = script.append("zxx").append(File.separator).append("Hebr").append(File.separator);
221+
break;
222+
default:
223+
break;
224+
}
225+
211226
String result = null;
227+
File pseudoMapFile = new File(pseudoRoot, script.toString() + "pseudomap.json");
212228
try {
213-
Scanner scanner = new Scanner(new FileInputStream(new File(pseudoRoot, "pseudomap.json")), "utf-8");
229+
Scanner scanner = new Scanner(new FileInputStream(pseudoMapFile), "utf-8");
214230
result = scanner.useDelimiter("\\A").next();
215231
scanner.close();
216232
} catch (FileNotFoundException e1) {
@@ -344,12 +360,12 @@ protected String pseudo(String source)
344360
}
345361
} else {
346362
String c = source.substring(i, i+1);
347-
ret.append(pseudoMap.get(c));
363+
ret.append( getPseudoCharacter(c) );
348364
}
349365
}
350366
} else {
351367
String c = source.substring(i, i+1);
352-
ret.append(pseudoMap.get(c));
368+
ret.append( getPseudoCharacter(c) );
353369
}
354370
}
355371
if (this.lengthen) {
@@ -368,6 +384,11 @@ protected String pseudo(String source)
368384
return ret.toString();
369385
}
370386

387+
protected String getPseudoCharacter(String character)
388+
{
389+
return pseudoMap.containsKey(character) ? pseudoMap.get(character) : character;
390+
}
391+
371392
/**
372393
* @param str
373394
* @return
@@ -433,13 +454,23 @@ public IString getString(String source, String key)
433454

434455
if (locale.isPseudo()) {
435456
String str = (source != null) ? source : (translations != null ? translations.get(key) : key);
436-
return new IString(pseudo(str));
457+
return new IString(pseudo(str), locale.getLanguage());
437458
}
438-
459+
439460
String keyName = (key != null && key.length() > 0) ? key : makeKey(source);
440461
String trans = ( translations != null && translations.containsKey(keyName) ) ? translations.get(keyName) : source;
441462
return new IString((type.equals("xml") || type.equals("html")) ? escape(trans) : trans, locale.getLanguage());
442463
}
464+
465+
/**
466+
*
467+
*/
468+
public IString getStringPseudo(String source, String key) {
469+
if (source == null && key == null) return null;
470+
471+
String str = (source != null) ? source : (translations != null ? translations.get(key) : key);
472+
return new IString(pseudo(str), locale.getLanguage());
473+
}
443474

444475
/**
445476
* @param source
Collapse file

‎java/src/com/ilib/test/ResBundleTest.java‎

Copy file name to clipboardExpand all lines: java/src/com/ilib/test/ResBundleTest.java
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,31 @@ public void testGetLocaleWithResourcesNewZeland()
212212

213213
assertEquals(locale.toString(), resBundle.getLocale().toString());
214214
}
215+
216+
public void testGetStringDefaultPseudo()
217+
{
218+
final IlibLocale locale = new IlibLocale("zxx");
219+
ResBundle resBundle = new ResBundle("resources", locale);
220+
assertNotNull(resBundle);
221+
222+
assertEquals("Ïñvàľíð Ňëţŵõŕķ Ňàmë9876543210", resBundle.getString("Invalid Network Name").toString());
223+
}
224+
225+
public void testGetStringCyrlPseudo()
226+
{
227+
final IlibLocale locale = new IlibLocale("zxx-Cyrl-RU");
228+
ResBundle resBundle = new ResBundle("resources", locale);
229+
assertNotNull(resBundle);
230+
231+
assertEquals("Инвалид Нэтwорк Намэ9876543210", resBundle.getString("Invalid Network Name").toString());
232+
}
215233

234+
public void testGetStringPseudo()
235+
{
236+
final IlibLocale locale = new IlibLocale("de-DE");
237+
ResBundle resBundle = new ResBundle("resources", locale);
238+
assertNotNull(resBundle);
239+
240+
assertEquals("àçţüàľ šţàţë fõŕ Ŵífí: 6543210", resBundle.getStringPseudo("actual state for Wifi: ", null).toString());
241+
}
216242
}
Collapse file

‎resources/zxx/Cyrl/strings.json‎

Copy file name to clipboard
+98Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
" at ": "mHzàt",
3+
"A verification email was sent to {email}.": "B2QÀ vèrïfïçàtïòñ èmàïl wàs sèñt tò {email}.01234567",
4+
"Back Up Now": "yWYBàçk Ùþ Ñòw01",
5+
"Backing up...": "suYBàçkïñg ùþ...01",
6+
"Backup complete": "u1KBàçkùþ çòmþlètè012",
7+
"Backup disabled": "CnIBàçkùþ dïsàßlèd012",
8+
"Backup failed": "Pk9Bàçkùþ fàïlèd01",
9+
"Backup failure": "P9gBàçkùþ fàïlùrè01",
10+
"Backup server unavailable": "rjmBàçkùþ sèrvèr ùñàvàïlàßlè01234",
11+
"Backup suspended": "3UCBàçkùþ sùsþèñdèd012",
12+
"Change Password": "VZ9Çhàñgè Pàsswòrd012",
13+
"Check your email for a message from mypalmaccounts@palm.com. Follow the link in that email to reset your password. <br/><br/>If you need more help, please visit www.palm.com.": "Oq3Çhèçk ÿòùr èmàïl fòr à mèssàgè fròm mÿþàlmàççòùñts@þàlm.çòm. Fòllòw thè lïñk ïñ thàt èmàïl tò rèsèt ÿòùr þàsswòrd. <br/><br/>Ìf ÿòù ñèèd mòrè hèlþ, þlèàsè vïsït www.palm.com.0123456789012345678901234567890123",
14+
"Choose Encryption Type": "JqWÇhòòsè Èñçrÿþtïòñ Tÿþè0123",
15+
"Connect with WPS PBC or PIN": "FHfÇòññèçt wïth WPS PBÇ òr PÌÑ01234",
16+
"Connect with WPS Push Button Configuration or PIN": "DM0Çòññèçt wïth WPS Pùsh Bùttòñ Çòñfïgùràtïòñ òr PÌÑ012345678",
17+
"Disconnect This Network": "minÐïsçòññèçt Thïs Ñètwòrk0123",
18+
"Don't Update": "qF9Ðòñ't Ùþdàtè01",
19+
"Done": "Tf3Ðòñè",
20+
"Edit Address": "HW4Èdït Àddrèss01",
21+
"Email Sent": "uJQÈmàïl Sèñt",
22+
"Enter Network Name (SSID)": "rlkÈñtèr Ñètwòrk Ñàmè (SSÌÐ)01234",
23+
"Error": "888Èrròr",
24+
"Forgot password": "sN2Fòrgòt þàsswòrd012",
25+
"HP webOS Account saved": "pBQHP wèßÒS Àççòùñt sàvèd0123",
26+
"Help": "ApIHèlþ",
27+
"I've pressed the button": "JXsÌ'vè þrèssèd thè ßùttòñ0123",
28+
"If you continue to have problems, visit palm.com/support.": "bNNÌf ÿòù çòñtïñùè tò hàvè þròßlèms, vïsït þàlm.çòm/sùþþòrt.01234567890",
29+
"If you turn off Backup, your device will no longer back up your data and your current back up will be erased.": "1t5Ìf ÿòù tùrñ òff Bàçkùþ, ÿòùr dèvïçè wïll ñò lòñgèr ßàçk ùþ ÿòùr dàtà àñd ÿòùr çùrrèñt ßàçk ùþ wïll ßè èràsèd.012345678901234567890",
30+
"Invalid Network Name": "U2TÌñvàlïd Ñètwòrk Ñàmè0123",
31+
"Invalid email address": "3AAÌñvàlïd èmàïl àddrèss0123",
32+
"Keep Backup On": "1dUKèèþ Bàçkùþ Òñ01",
33+
"No Internet Connection": "SsfÑò Ìñtèrñèt Çòññèçtïòñ0123",
34+
"No Internet connection": "GUvÑò Ìñtèrñèt çòññèçtïòñ0123",
35+
"No error message": "aIEÑò èrròr mèssàgè012",
36+
"OK": "pAkÒK",
37+
"Opt out failed. Try later": "fEcÒþt òùt fàïlèd. Trÿ làtèr01234",
38+
"PIN": "trRPÌÑ",
39+
"Palm Services": "kCyPàlm Sèrvïçès01",
40+
"Password changed": "4AjPàsswòrd çhàñgèd012",
41+
"Password reset": "Ad5Pàsswòrd rèsèt01",
42+
"Please choose the method you want to connect to the wireless router with.": "oWYPlèàsè çhòòsè thè mèthòd ÿòù wàñt tò çòññèçt tò thè wïrèlèss ròùtèr wïth.01234567890123",
43+
"Please enter the PIN": "afDPlèàsè èñtèr thè PÌÑ0123",
44+
"Please respond to the verification email sent to #{email} from Palm_Inc@email.palmnewsletters.com. The new email address will not be updated until it has been verified.": "7GtPlèàsè rèsþòñd tò thè vèrïfïçàtïòñ èmàïl sèñt tò #{email} fròm Pàlm_Ìñç@èmàïl.þàlmñèwslèttèrs.çòm. Thè ñèw èmàïl àddrèss wïll ñòt ßè ùþdàtèd ùñtïl ït hàs ßèèñ vèrïfïèd.012345678901234567890123456789012",
45+
"Please select a security question": "IaSPlèàsè sèlèçt à sèçùrïtÿ qùèstïòñ012345",
46+
"Policy restrictions on your #{accountAlias} Exchange account do not allow backups to be enabled and require that existing backups be deleted.": "0QnPòlïçÿ rèstrïçtïòñs òñ ÿòùr #{accountAlias} Èxçhàñgè àççòùñt dò ñòt àllòw ßàçkùþs tò ßè èñàßlèd àñd rèqùïrè thàt èxïstïñg ßàçkùþs ßè dèlètèd.0123456789012345678901234567",
47+
"Policy restrictions on your #{accountAlias} Exchange account do not allow backups to be enabled.": "CJ6Pòlïçÿ rèstrïçtïòñs òñ ÿòùr #{accountAlias} Èxçhàñgè àççòùñt dò ñòt àllòw ßàçkùþs tò ßè èñàßlèd.0123456789012345678",
48+
"Preparing": "TF0Prèþàrïñg",
49+
"Press the button on your wireless router": "ry0Prèss thè ßùttòñ òñ ÿòùr wïrèlèss ròùtèr01234567",
50+
"Processing opt out": "C5cPròçèssïñg òþt òùt012",
51+
"Push Button": "wktPùsh Bùttòñ01",
52+
"Select a question": "o6kSèlèçt à qùèstïòñ012",
53+
"Select the type of encryption used by %ssid%": "9khSèlèçt thè tÿþè òf èñçrÿþtïòñ ùsèd ßÿ %ssïd%01234567",
54+
"Sending password reset email": "aeQSèñdïñg þàsswòrd rèsèt èmàïl01234",
55+
"Sign In": "SIJSïgñ Ìñ",
56+
"Sign in": "7eJSïgñ ïñ",
57+
"Signing in...": "I6ZSïgñïñg ïñ...01",
58+
"Stupid lose": "l1CStùþïd lòsè01",
59+
"To recover your password, you must reset your password at the link emailed to #{email}.": "akOTò rèçòvèr ÿòùr þàsswòrd, ÿòù mùst rèsèt ÿòùr þàsswòrd àt thè lïñk èmàïlèd tò #{email}.01234567890123456",
60+
"Turn Backup off?": "iyMTùrñ Bàçkùþ òff¿012",
61+
"Turn Backup on to start backing up your data automatically.": "ln1Tùrñ Bàçkùþ òñ tò stàrt ßàçkïñg ùþ ÿòùr dàtà àùtòmàtïçàllÿ.01234567890",
62+
"Turn Off and Erase Backup": "zGsTùrñ Òff àñd Èràsè Bàçkùþ01234",
63+
"Turn WiFi Off": "QcXTùrñ WïFï Òff01",
64+
"Turn WiFi On": "FAATùrñ WïFï Òñ01",
65+
"Turning Backup off": "vnhTùrñïñg Bàçkùþ òff012",
66+
"Verify new email": "LmPVèrïfÿ ñèw èmàïl012",
67+
"WEP": "oTFWÈP",
68+
"WEP2": "h0YWÈP2",
69+
"WPA": "eqUWPÀ",
70+
"WPA-PSK": "aZdWPÀ-PSK",
71+
"WPA2": "eR0WPÀ2",
72+
"WPA2-PSK": "WrkWPÀ2-PSK",
73+
"WPS PIN": "k9HWPS PÌÑ",
74+
"WPS PIN Configuration": "XipWPS PÌÑ Çòñfïgùràtïòñ0123",
75+
"WPS Push Button Configuration": "pRuWPS Pùsh Bùttòñ Çòñfïgùràtïòñ01234",
76+
"We could not send an email to reset your password. Visit palm.com/support for more help.": "t5DWè çòùld ñòt sèñd àñ èmàïl tò rèsèt ÿòùr þàsswòrd. Vïsït þàlm.çòm/sùþþòrt fòr mòrè hèlþ.01234567890123456",
77+
"We will send your confirmation email as soon as you have an internet connection.": "xxEWè wïll sèñd ÿòùr çòñfïrmàtïòñ èmàïl às sòòñ às ÿòù hàvè àñ ïñtèrñèt çòññèçtïòñ.0123456789012345",
78+
"Wireless": "mA4Wïrèlèss",
79+
"You must have an internet connection to continue.": "RWEÝòù mùst hàvè àñ ïñtèrñèt çòññèçtïòñ tò çòñtïñùè.012345678",
80+
"You must use a valid email address format.": "SyFÝòù mùst ùsè à vàlïd èmàïl àddrèss fòrmàt.01234567",
81+
"You need an Internet connection to back up your data.": "r67Ýòù ñèèd àñ Ìñtèrñèt çòññèçtïòñ tò ßàçk ùþ ÿòùr dàtà.0123456789",
82+
"You need an internet connection to turn off automatic backup.": "diUÝòù ñèèd àñ ïñtèrñèt çòññèçtïòñ tò tùrñ òff àùtòmàtïç ßàçkùþ.012345678901",
83+
"Your HP webOS Account and other personal data (including potentially sensitive data that may be provided during the use of the device and its features) are backed up automatically every day. This data is stored on secured servers and used solely for recovery purposes.<br><br>Visit <a href='http://www.palm.com/webos-usingbackup-en'>Using Backup</a> for additional details.": "0LfÝòùr HP wèßÒS Àççòùñt àñd òthèr þèrsòñàl dàtà (ïñçlùdïñg þòtèñtïàllÿ sèñsïtïvè dàtà thàt màÿ ßè þròvïdèd dùrïñg thè ùsè òf thè dèvïçè àñd ïts fèàtùrès) àrè ßàçkèd ùþ àùtòmàtïçàllÿ èvèrÿ dàÿ. Thïs dàtà ïs stòrèd òñ sèçùrèd sèrvèrs àñd ùsèd sòlèlÿ fòr rèçòvèrÿ þùrþòsès.<br><br>Vïsït <a href='http://www.palm.com/webos-usingbackup-en'>Ùsïñg Bàçkùþ</a> fòr àddïtïòñàl dètàïls.01234567890123456789012345678901234567890123456789012345678901234567890123",
84+
"Your data will be backed up automatically when the server is available again.": "K9nÝòùr dàtà wïll ßè ßàçkèd ùþ àùtòmàtïçàllÿ whèñ thè sèrvèr ïs àvàïlàßlè àgàïñ.012345678901234",
85+
"Your device has not been backed up in #{day} days. Try selecting Back Up Now.": "1b3Ýòùr dèvïçè hàs ñòt ßèèñ ßàçkèd ùþ ïñ #{day} dàÿs. Trÿ sèlèçtïñg Bàçk Ùþ Ñòw.012345678901234",
86+
"actual state for Wifi: ": "b21àçtùàl stàtè fòr Wïfï:0123",
87+
"associated": "z4Wàssòçïàtèd",
88+
"associating": "XTsàssòçïàtïñg01",
89+
"association failed: incorrect password": "M2jàssòçïàtïòñ fàïlèd: ïñçòrrèçt þàsswòrd0123456",
90+
"confirm password...": "VqEçòñfïrm þàsswòrd...012",
91+
"enter password...": "wpQèñtèr þàsswòrd...012",
92+
"ip configured": "Sy7ïþ çòñfïgùrèd01",
93+
"ip failed": "qmGïþ fàïlèd",
94+
"not associated": "LA5ñòt àssòçïàtèd01",
95+
"real Fun": "Aebrèàl Fùñ",
96+
"test1": "BeAtèst1",
97+
"unknown state for Wifi: ": "vDYùñkñòwñ stàtè fòr Wïfï:0123"
98+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.