/* * Copyright (c) 2011-2014 Julien Nicoulaud <julien.nicoulaud@gmail.com> * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 net.nicoulaj.idea.markdown; import com.intellij.CommonBundle; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.PropertyKey; import java.util.ResourceBundle; /** * {@link ResourceBundle}/localization utils for the Markdown plugin. * * @author Julien Nicoulaud <julien.nicoulaud@gmail.com> * @since 0.1 */ public class MarkdownBundle { /** The {@link ResourceBundle} path. */ @NonNls protected static final String BUNDLE_NAME = "net.nicoulaj.idea.markdown.localization.strings"; /** * The {@link ResourceBundle} instance. * * @see #BUNDLE_NAME */ protected static final ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); /** {@link MarkdownBundle} is a non-instantiable static class. */ private MarkdownBundle() { } /** * Load a {@link String} from the {@link #BUNDLE} {@link ResourceBundle}. * * @param key the key of the resource. * @param params the optional parameters for the specific resource. * @return the {@link String} value or {@code null} if no resource found for the key. */ public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) { return CommonBundle.message(BUNDLE, key, params); } /** * Load a {@link String} from the {@link #BUNDLE} {@link ResourceBundle}. * * @param key the key of the resource. * @param params the optional parameters for the specific resource. * @return the {@link String} value or an empty {@link String} if no resource found for the key. */ public static String messageOrBlank(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) { return CommonBundle.messageOrDefault(BUNDLE, key, "", params); } }