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

org.nuiton.i18n.format.MessageFormatI18nMessageFormatter Maven / Gradle / Ivy

The newest version!
/*
 * #%L
 * I18n :: Api
 * %%
 * Copyright (C) 2004 - 2017 Code Lutin, Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program 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 Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * .
 * #L%
 */
package org.nuiton.i18n.format;

import java.text.MessageFormat;
import java.util.Locale;

/**
 * Implementation of {@link I18nMessageFormatter} based on
 * {@link MessageFormat} syntax.
 * 

* Note: A formatter will always be used even if there is no * parameters in translation. As {@link MessageFormat} requires to espece * quotes, we need to do this for every translation with or without parameters. * * @see MessageFormat * @since 2.4 */ public class MessageFormatI18nMessageFormatter implements I18nMessageFormatter { @Override public String format(Locale locale, String message, Object... args) { MessageFormat formatter = new MessageFormat(message, locale); return formatter.format(args); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy