Java Code Examples for java.util.Locale.Builder#build()
The following examples show how to use
java.util.Locale.Builder#build() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocaleEnhanceTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 2
Source File: LocaleEnhanceTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 3
Source File: LocaleEnhanceTest.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 4
Source File: LocaleEnhanceTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 5
Source File: LocaleEnhanceTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 6
Source File: LocaleEnhanceTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 7
Source File: LocaleEnhanceTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 8
Source File: LocaleEnhanceTest.java From hottub with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 9
Source File: LocaleEnhanceTest.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 10
Source File: LocaleEnhanceTest.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 11
Source File: LocaleEnhanceTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 12
Source File: LocaleEnhanceTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }
Example 13
Source File: LocaleEnhanceTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void testBug7002320() { // forLanguageTag() and Builder.setLanguageTag(String) // should add a location extension for following two cases. // // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*) // is exactly "JP" and no BCP 47 extensions are available, then add // a Unicode locale extension "ca-japanese". // 2. language/country are "th"/"TH" and the resolved variant is exactly // "TH" and no BCP 47 extensions are available, then add a Unicode locale // extension "nu-thai". // String[][] testdata = { {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1 {"ja-JP-x-lvariant-JP-XXX"}, {"ja-JP-u-ca-japanese-x-lvariant-JP"}, {"ja-JP-u-ca-gregory-x-lvariant-JP"}, {"ja-JP-u-cu-jpy-x-lvariant-JP"}, {"ja-x-lvariant-JP"}, {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2 {"th-TH-u-nu-thai-x-lvariant-TH"}, {"en-US-x-lvariant-JP"}, }; Builder bldr = new Builder(); for (String[] data : testdata) { String in = data[0]; String expected = (data.length == 1) ? data[0] : data[1]; // forLanguageTag Locale loc = Locale.forLanguageTag(in); String out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out); // setLanguageTag bldr.clear(); bldr.setLanguageTag(in); loc = bldr.build(); out = loc.toLanguageTag(); assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out); } }