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

com.codepulsar.nils.core.NLS Maven / Gradle / Ivy

Go to download

The core NILS library - A Java NLS library (aka national language support, localisation, internationalisation, i18n, l10n).

There is a newer version: 3.0.0
Show newest version
package com.codepulsar.nils.core;

import java.util.Locale;

import com.codepulsar.nils.core.handler.ClassPrefixResolver;

/**
 * The NLS provides access to "national language support" related function for a
 * specific Locale.
 */
public interface NLS {
  /**
   * Get the translation for the requested key.
   *
   * @param key The key for the translation
   * @return The translation
   */
  String get(String key);
  /**
   * Get the translation for the requested key with arguments that should be replaced in the
   * translation.
   *
   * @param key The key for the translation
   * @param args Arguments for the translation
   * @return The translation
   */
  String get(String key, Object... args);
  /**
   * Get the translation for the requested key.
   *
   * 

The Class is used a base key. The subKey as a further key. Both, the key and * subKey, will be concatenated like 'MyClass.attrbute'. * * @param key A Class as base key for the translation * @param subKey The sub key, like an attribute of the class * @return The translation */ String get(Class key, String subKey); /** * Get the translation for the requested key with arguments that should be replaced in the * translation. * *

The Class is used a base key. The subKey as a further key. Both, the key and * subKey, will be concatenated like 'MyClass.attrbute'. * * @param key A Class as base key for the translation * @param subKey The sub key, like an attribute of the class * @param args Arguments for the translation * @return The translation */ String get(Class key, String subKey, Object... args); /** * Get the Locale the NLS is responsible for. * * @return A Locale object. */ Locale getLocale(); /** * Get the {@link Formats} for the Locale of NLS. * * @return A {@link Formats} object. */ Formats getFormats(); /** * Get a {@link NLS} object for a specific context. * *

Only the keys beneath the context will be examined. * * @param context The context key. * @return A {@link NLS} object. */ NLS context(String context); /** * Get a {@link NLS} object for a specific context based on a Class. * *

Only the keys beneath the context will be examined. * *

The determination of the Class as key will be done with the configured {@link * ClassPrefixResolver}. * * @param context The Class for the context key. * @return A {@link NLS} object. * @see NilsConfig#getClassPrefixResolver() */ NLS context(Class context); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy