Translations works alpha

This commit is contained in:
Georgy Litvinov 2021-07-03 01:13:38 +02:00
parent a7e1e60c7e
commit aacfe0dfcd
3 changed files with 450 additions and 5 deletions

View file

@ -20,7 +20,10 @@ import org.apache.commons.logging.LogFactory;
*/
public class I18nBundle {
private static final Log log = LogFactory.getLog(I18nBundle.class);
private static final String startSep = "\u25a4";
private static final String endSep = "\u25a5";
private static final String intSep = "\u25a6";
private static boolean exportInfo = true;
private static final String MESSAGE_BUNDLE_NOT_FOUND = "Text bundle ''{0}'' not found.";
private static final String MESSAGE_KEY_NOT_FOUND = "Text bundle ''{0}'' has no text for ''{1}''";
@ -75,13 +78,22 @@ public class I18nBundle {
key);
log.warn(message);
textString = "ERROR: " + message;
}
String result = formatString(textString, parameters);
}
String message = formatString(textString, parameters);
if (i18nLogger != null) {
i18nLogger.log(bundleName, key, parameters, textString, result);
i18nLogger.log(bundleName, key, parameters, textString, message);
}
return result;
if (exportInfo) {
String separatedArgs = "";
for (int i = 0; i < parameters.length; i++) {
separatedArgs += parameters[i] + intSep;
}
return startSep + key + intSep + textString + intSep + separatedArgs + message + endSep;
} else {
return message;
}
}
private static String formatString(String textString, Object... parameters) {