--- /dev/null
+/**
+ * Macaco
+ * Copyright (c) 2009-2015 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+@SuppressWarnings("serial")
+public class MTranslationValueNotFoundException extends MTranslationException {
+
+ /* */
+
+ public MTranslationValueNotFoundException() {
+ super();
+ }
+
+ public MTranslationValueNotFoundException(String message) {
+ super(message);
+ }
+
+ public MTranslationValueNotFoundException(Throwable error) {
+ super(error);
+ }
+
+ public MTranslationValueNotFoundException(String message, Throwable error) {
+ super(message, error);
+ }
+
+}
+++ /dev/null
-/**
- * Macaco
- * Copyright (c) 2009-2015 Marco Zanon <info@marcozanon.com>.
- * Released under MIT license (see LICENSE for details).
- */
-
-package com.marcozanon.macaco.text;
-
-@SuppressWarnings("serial")
-public class MTranslationValueNotFoundTextException extends MTranslationException {
-
- /* */
-
- public MTranslationValueNotFoundTextException() {
- super();
- }
-
- public MTranslationValueNotFoundTextException(String message) {
- super(message);
- }
-
- public MTranslationValueNotFoundTextException(Throwable error) {
- super(error);
- }
-
- public MTranslationValueNotFoundTextException(String message, Throwable error) {
- super(message, error);
- }
-
-}
try {
translation = this.getTranslation(message, locale, false);
}
- catch (MTranslationValueNotFoundTextException exception) { // cannot happen
+ catch (MTranslationValueNotFoundException exception) { // cannot happen
}
return translation;
}
- public String getStrictTranslation(String message, Locale locale) throws MTranslationValueNotFoundTextException {
+ public String getStrictTranslation(String message, Locale locale) throws MTranslationValueNotFoundException {
return this.getTranslation(message, locale, true);
}
- protected String getTranslation(String message, Locale locale, boolean strictMode) throws MTranslationValueNotFoundTextException {
+ protected String getTranslation(String message, Locale locale, boolean strictMode) throws MTranslationValueNotFoundException {
if (MText.isBlank(message)) {
throw new IllegalArgumentException("Invalid 'message': null or empty.");
}
//
if (!this.getMessagesReference().containsKey(message)) {
if (strictMode) {
- throw new MTranslationValueNotFoundTextException(String.format("Invalid 'message': %s: not available.", message));
+ throw new MTranslationValueNotFoundException(String.format("Invalid 'message': %s: not available.", message));
}
return message;
}
String localeRepresentation = locale.toString();
if (!messageTranslations.containsKey(localeRepresentation)) {
if (strictMode) {
- throw new MTranslationValueNotFoundTextException(String.format("Invalid 'locale': %s: translation not available for message: %s.", localeRepresentation, message));
+ throw new MTranslationValueNotFoundException(String.format("Invalid 'locale': %s: translation not available for message: %s.", localeRepresentation, message));
}
String localeFallbackRepresentation = locale.getLanguage();
if (!messageTranslations.containsKey(localeFallbackRepresentation)) {