JPP: Removed enum from kaas talk localizer
Some checks failed
Run test asserts / Test-Asserts (push) Failing after 45s
Some checks failed
Run test asserts / Test-Asserts (push) Failing after 45s
This commit is contained in:
parent
4ba8edbb6e
commit
04d6d2e3b3
9 changed files with 86 additions and 22 deletions
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
package ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ;
|
||||
|
||||
/// Marker interface for using babel blue text.
|
||||
/// Marker interface for using kaas talk text.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
|
|
|
|||
|
|
@ -35,21 +35,23 @@ import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.NetherTone;
|
|||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum KaasTalkTextFactory {
|
||||
亞;
|
||||
public final class KaasTalkTextLocalizer {
|
||||
|
||||
public String buildMessage(final Class<? extends KaasTalkText> babelMsg, final Object...msgArgs) {
|
||||
return buildMessage(null , babelMsg, msgArgs);
|
||||
private KaasTalkTextLocalizer() {
|
||||
}
|
||||
|
||||
static public String format(final Class<? extends KaasTalkText> babelMsg, final Object...msgArgs) {
|
||||
return formatToned(null , babelMsg, msgArgs);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String buildMessage(final Class<? extends NetherTone> linguaId, final Class<? extends KaasTalkText> babelMsg, final Object...msgArgs) {
|
||||
static public String formatToned(final Class<? extends NetherTone> linguaId, final Class<? extends KaasTalkText> babelMsg, final Object...msgArgs) {
|
||||
if (babelMsg == null) {
|
||||
throw new NullPointerException("No babel message class given.");
|
||||
throw new NullPointerException("No kaas talk message class given.");
|
||||
}
|
||||
Object[] formatArgs = Arrays.asList(msgArgs).stream().map(v -> {
|
||||
if (v instanceof Class<?> && KaasTalkText.class.isAssignableFrom((Class<?>)v)) {
|
||||
return buildMessage(linguaId, (Class<KaasTalkText>)v);
|
||||
return formatToned(linguaId, (Class<KaasTalkText>)v);
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
|
|
@ -60,7 +62,7 @@ public enum KaasTalkTextFactory {
|
|||
}
|
||||
KaasTalkTextRepeatable注 stringTower = babelMsg.getAnnotation(KaasTalkTextRepeatable注.class);
|
||||
if (stringTower == null) {
|
||||
throw new RuntimeException("No BabelẞlueText注 annotation on: " + babelMsg);
|
||||
throw new RuntimeException("No KaasTalkText注 annotation on: " + babelMsg);
|
||||
}
|
||||
KaasTalkText注 fallback = null;
|
||||
for (KaasTalkText注 duyts:stringTower.value()) {
|
||||
|
|
@ -77,6 +79,6 @@ public enum KaasTalkTextFactory {
|
|||
if (fallback != null) {
|
||||
return String.format(fallback.txt(), formatArgs);
|
||||
}
|
||||
throw new RuntimeException("Empty BabelẞlueTextRepeatable注 annotations on: " + babelMsg);
|
||||
throw new RuntimeException("Empty KaasTalkTextRepeatable注 annotations on: " + babelMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/// Babel blue translations text container.
|
||||
/// Kaas talk translations text container.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import java.lang.annotation.Target;
|
|||
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.NetherTone;
|
||||
|
||||
/// Define babel blue text.
|
||||
/// Define kaas talk text.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue