LanguageService.java

/*
 * Copyright 2020 Global Crop Diversity Trust
 *
 * 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.
 */
package org.gringlobal.service;

import java.util.Locale;

import org.gringlobal.model.SysLang;

/**
 * @author Matija Obreza
 */
public interface LanguageService extends CRUDService<SysLang> {

	SysLang DEFAULT_LANGUAGE = new SysLang(1L); // English
	String MCPD_IETF_TAG = "MCPD";

	/**
	 * Ensure SysLang record
	 *
	 * @param ietfTag the ietfTag
	 * @param iso6393Tag the iso6393Tag
	 * @param title the title
	 * @param description the description
	 * @return the record
	 */
	SysLang ensureSysLang(String ietfTag, String iso6393Tag, String title, String description);

	/**
	 * Find language by code
	 * 
	 * @param lang language code
	 * @return
	 */
	SysLang getLanguage(String lang);

	/**
	 * Gets the language for the specified locale.
	 *
	 * @param locale the locale
	 * @return the language
	 */
	SysLang getLanguage(Locale locale);

	/**
	 * List enabled languages
	 *
	 * @return list
	 */
	Iterable<SysLang> listEnabledLanguages();

}