PR: MPXDOC-128

Submitted by: Vincent Siveton
Reviewed by:  Brett Porter, Arnaud Heritier
Internationalization support for xdoc.
Applied with changes

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@171222 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett committed 2005-05-21 15:10:41 +00:00
1 parent 489cf92482
commit 4e177daa2d
49 files changed
+3470 -1027

No files matched your search

@@ -0,0 +1,69 @@
package org.apache.maven.xdoc.util;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.util.Locale;
import org.apache.maven.xdoc.util.LocaleUtil;
import junit.framework.TestCase;
/**
* LocaleUtil Test class.
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @version $Id$
*/
public class LocaleUtilTest extends TestCase {
public void testCodeToLocale1() {
Locale locale = LocaleUtil.codeToLocale("en");
assertEquals(locale.toString(), "en");
}
public void testCodeToLocale2() {
Locale locale = LocaleUtil.codeToLocale("en_CA");
assertEquals(locale.toString(), "en_CA");
}
public void testCodeToLocaleAsNull() {
Locale locale = LocaleUtil.codeToLocale(null);
assertNull(locale);
}
public void testCodeToLocaleAsDefault() {
Locale locale = LocaleUtil.codeToLocale("default");
assertEquals(locale, Locale.getDefault());
}
public void testCodesToLocales() {
Locale[] locales = LocaleUtil.codesToLocales("en, en_CA");
assertEquals(locales[0].toString(), "en");
assertEquals(locales[1].toString(), "en_CA");
}
public void testCodesToLocalesAsNull() {
Locale[] locales = LocaleUtil.codesToLocales(null);
assertNull(locales);
}
public void testDisplayName() {
Locale locale = new Locale("fr");
String result = LocaleUtil.displayName(locale, locale);
assertEquals(result, "Français");
}
}