001/* 002 * ModeShape (http://www.modeshape.org) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.modeshape.common.i18n; 017 018import java.util.Locale; 019import org.modeshape.common.util.StringUtil; 020 021/** 022 * A pass-through implementation of {@link org.modeshape.common.i18n.I18nResource} which uses an underlying text as the real 023 * value, ignoring any kind of internationalization. 024 */ 025public final class TextI18n implements I18nResource { 026 private static final String BLANK = ""; 027 028 private final String text; 029 030 public TextI18n( String text ) { 031 this.text = StringUtil.isBlank(text) ? BLANK : text; 032 } 033 034 @Override 035 public String text( Object... arguments ) { 036 return StringUtil.createString(text, arguments); 037 } 038 039 @Override 040 public String text( Locale locale, 041 Object... arguments ) { 042 return StringUtil.createString(text, arguments); 043 } 044}