001package org.hl7.fhir.utilities;
002
003/*-
004 * #%L
005 * org.hl7.fhir.utilities
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024import java.util.Date;
025import java.util.Map;
026import java.util.Set;
027
028public interface TranslationServices {
029  /**
030   * General translation functionality - given a string, translate it to a different language
031   * 
032   * @param context - for debugging purposes
033   * @param value - the string to translate
034   * @param targetLang - the target language to translate to. 
035   * 
036   * @return the translated string, or value if no translation is found
037   */
038  String translate(String context, String value, String targetLang);
039
040  /**
041   * General translation functionality - given a string, translate it to a different language, but also perform String.format on the outcome.
042   * 
043   * @param contest
044   * @param lang
045   * @param string2
046   * @param args
047   * @return
048   */
049  String translateAndFormat(String contest, String lang, String string2, Object... args);
050
051  /** 
052   * equivalent to the general translation operation, but the context that provides the transations specifies the target language
053   *  
054   * @param context
055   * @param value
056   * @return
057   */
058  String translate(String context, String value);
059
060  /**
061   * Get a list of all translations available for a phrase
062   * 
063   * @param value
064   * @return
065   */
066  Map<String, String> translations(String value);
067
068  /** 
069   * localization for converting a decimal to language specific representation
070   * 
071   * @param value
072   * @return
073   */
074  String toStr(float value);
075
076  /** 
077   * localization for converting a date to language specific representation
078   * 
079   * @param value
080   * @return
081   */
082  String toStr(Date value);
083
084  /**
085   * get a list of translation codes by category
086   * @param category
087   * @return
088   */
089  Set<String> listTranslations(String category);
090
091}