All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jaeksoft.searchlib.analysis.LanguageEnum Maven / Gradle / Ivy

Go to download

OpenSearchServer is a powerful, enterprise-class, search engine program. Using the web user interface, the crawlers (web, file, database, ...) and the REST/RESTFul API you will be able to integrate quickly and easily advanced full-text search capabilities in your application. OpenSearchServer runs on Windows and Linux/Unix/BSD.

The newest version!
/**   
 * License Agreement for OpenSearchServer
 *
 * Copyright (C) 2009-2013 Emmanuel Keller / Jaeksoft
 * 
 * http://www.open-search-server.com
 * 
 * This file is part of OpenSearchServer.
 *
 * OpenSearchServer is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 * OpenSearchServer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with OpenSearchServer. 
 *  If not, see .
 **/

package com.jaeksoft.searchlib.analysis;

public enum LanguageEnum {

	UNDEFINED("Undefined", ""),

	ARABIC("Arabic", "ar"),

	CHINESE("Chinese", "zh", "zh-cn"),

	DANISH("Danish", "da"),

	CZECH("Czech", "cz", "cs"),

	DUTCH("Dutch", "nl"),

	ENGLISH("English", "en"),

	FINNISH("Finnish", "fi"),

	FRENCH("French", "fr"),

	GERMAN("German", "de"),

	HUNGARIAN("Hungarian", "hu"),

	ITALIAN("Italian", "it"),

	JAPANESE("Japanese", "ja"),

	KOREAN("Korean", "kr", "ko"),

	NORWEGIAN("Norwegian", "no"),

	POLISH("Polish", "pl"),

	PORTUGUESE("Portuguese", "pt"),

	ROMANIAN("Romanian", "ro"),

	RUSSIAN("Russian", "ru"),

	SPANISH("Spanish", "es"),

	SWEDISH("Swedish", "sv"),

	TURKISH("Turkish", "tr");

	private final String name;

	private final String code;

	private final String alternativeCode;

	private LanguageEnum(String name, String code, String alternativeCode) {
		this.name = name;
		this.code = code;
		this.alternativeCode = alternativeCode;
	}

	private LanguageEnum(String name, String code) {
		this(name, code, null);
	}

	public String getName() {
		return name;
	}

	public String getCode() {
		return code;
	}

	public String getAlternativeCode() {
		return alternativeCode;
	}

	public static LanguageEnum findByCode(String code) {
		if (code == null)
			return UNDEFINED;
		for (LanguageEnum lang : LanguageEnum.values())
			if (code.equalsIgnoreCase(lang.code))
				return lang;
		return UNDEFINED;
	}

	public static LanguageEnum findByName(String name) {
		if (name == null)
			return UNDEFINED;
		for (LanguageEnum lang : LanguageEnum.values())
			if (name.equalsIgnoreCase(lang.name))
				return lang;
		return UNDEFINED;
	}

	public static LanguageEnum findByNameOrCode(String nameOrCode) {
		if (nameOrCode == null)
			return UNDEFINED;
		LanguageEnum lang = findByName(nameOrCode);
		if (lang != UNDEFINED)
			return lang;
		return findByCode(nameOrCode);
	}

	public static String[] stringArray() {
		String[] array = new String[values().length];
		int i = 0;
		for (LanguageEnum lang : LanguageEnum.values())
			array[i++] = lang.name;
		return array;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy