當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalizationUtils類代碼示例

本文整理匯總了Java中org.javarosa.core.services.locale.LocalizationUtils的典型用法代碼示例。如果您正苦於以下問題:Java LocalizationUtils類的具體用法?Java LocalizationUtils怎麽用?Java LocalizationUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LocalizationUtils類屬於org.javarosa.core.services.locale包,在下文中一共展示了LocalizationUtils類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testParseAndAdd

import org.javarosa.core.services.locale.LocalizationUtils; //導入依賴的package包/類
@Test
public void testParseAndAdd() {
    OrderedHashtable<String, String> testTable = new OrderedHashtable<String, String>();

    LocalizationUtils.parseAndAdd(testTable, "string.1=this line should be cutoff here# this is bad if present", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.2=this line should be cutoff here after the space # this is bad is present", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.3=this line should all be here#", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.4=this line should all be here #", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.5=this line should be all here \\# including this \\# and this", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.6=this line should be here \\# and this# not this", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.7=this line should be here \\# and this# not this \\# not this either", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.8=we have a hash \\# and a newline \\n", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.9=this line should all be here with the hash \\#", 0);
    // make sure doesn't crash
    LocalizationUtils.parseAndAdd(testTable, "# this is the whole line", 0);

    assertTrue("Line 1 failed: " + testTable.get("string.1"), testTable.get("string.1").equals("this line should be cutoff here"));
    assertTrue("Line 2 failed: " + testTable.get("string.2"), testTable.get("string.2").equals("this line should be cutoff here after the space "));
    assertTrue("Line 3 failed: " + testTable.get("string.3"), testTable.get("string.3").equals("this line should all be here"));
    assertTrue("Line 4 failed: " + testTable.get("string.4"), testTable.get("string.4").equals("this line should all be here "));
    assertTrue("Line 5 failed: " + testTable.get("string.5"), testTable.get("string.5").equals("this line should be all here # including this # and this"));
    assertTrue("Line 6 failed: " + testTable.get("string.6"), testTable.get("string.6").equals("this line should be here # and this"));
    assertTrue("Line 7 failed: " + testTable.get("string.7"), testTable.get("string.7").equals("this line should be here # and this"));
    assertTrue("Line 8 failed: " + testTable.get("string.8"), testTable.get("string.8").equals("we have a hash # and a newline \n"));
    assertTrue("Line 9 failed: " + testTable.get("string.9"), testTable.get("string.9").equals("this line should all be here with the hash #"));
}
 
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:27,代碼來源:LocalizationTests.java

示例2: testParseAndAdd

import org.javarosa.core.services.locale.LocalizationUtils; //導入依賴的package包/類
@Test
public void testParseAndAdd() {
    OrderedHashtable<String, String> testTable = new OrderedHashtable<>();

    LocalizationUtils.parseAndAdd(testTable, "string.1=this line should be cutoff here# this is bad if present", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.2=this line should be cutoff here after the space # this is bad is present", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.3=this line should all be here#", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.4=this line should all be here #", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.5=this line should be all here \\# including this \\# and this", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.6=this line should be here \\# and this# not this", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.7=this line should be here \\# and this# not this \\# not this either", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.8=we have a hash \\# and a newline \\n", 0);
    LocalizationUtils.parseAndAdd(testTable, "string.9=this line should all be here with the hash \\#", 0);
    // make sure doesn't crash
    LocalizationUtils.parseAndAdd(testTable, "# this is the whole line", 0);

    assertTrue("Line 1 failed: " + testTable.get("string.1"), testTable.get("string.1").equals("this line should be cutoff here"));
    assertTrue("Line 2 failed: " + testTable.get("string.2"), testTable.get("string.2").equals("this line should be cutoff here after the space "));
    assertTrue("Line 3 failed: " + testTable.get("string.3"), testTable.get("string.3").equals("this line should all be here"));
    assertTrue("Line 4 failed: " + testTable.get("string.4"), testTable.get("string.4").equals("this line should all be here "));
    assertTrue("Line 5 failed: " + testTable.get("string.5"), testTable.get("string.5").equals("this line should be all here # including this # and this"));
    assertTrue("Line 6 failed: " + testTable.get("string.6"), testTable.get("string.6").equals("this line should be here # and this"));
    assertTrue("Line 7 failed: " + testTable.get("string.7"), testTable.get("string.7").equals("this line should be here # and this"));
    assertTrue("Line 8 failed: " + testTable.get("string.8"), testTable.get("string.8").equals("we have a hash # and a newline \n"));
    assertTrue("Line 9 failed: " + testTable.get("string.9"), testTable.get("string.9").equals("this line should all be here with the hash #"));
}
 
開發者ID:dimagi,項目名稱:commcare-core,代碼行數:27,代碼來源:LocalizationTests.java

示例3: testParseValue

import org.javarosa.core.services.locale.LocalizationUtils; //導入依賴的package包/類
@Test
public void testParseValue() {
    String result1 = "";
    String result2 = "";

    result1 = LocalizationUtils.parseValue("1. One \\n2. Two \\n3. Three");
    result2 = LocalizationUtils.parseValue("\\# Start");

    assertTrue("Parsed newlines correctly", result1.equals("1. One \n2. Two \n3. Three"));
    assertTrue("Parsed newlines correctly", result2.equals("# Start"));
}
 
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:12,代碼來源:LocalizationTests.java


注:本文中的org.javarosa.core.services.locale.LocalizationUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。