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
|
|
@ -30,7 +30,7 @@ package ᒢᐩᐩ.ᒃᣔᔆᔆᒃᐤᐤᣕ.ᒼᒻᣔᙆᙆ;
|
|||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᒢℭỗᶇṧⱦᶏꬼȶʂ;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkText;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextFactory;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextLocalizer;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public final class BãßBȍőnSovjetᣟошибкаᣟзапускаᣟракеты extends RuntimeException {
|
||||
|
|
@ -42,6 +42,6 @@ public final class BãßBȍőnSovjetᣟошибкаᣟзапускаᣟраке
|
|||
}
|
||||
|
||||
public BãßBȍőnSovjetᣟошибкаᣟзапускаᣟракеты(Class<? extends KaasTalkText> babelText, Object...args) {
|
||||
super(KaasTalkTextFactory.亞.buildMessage(babelText, args));
|
||||
super(KaasTalkTextLocalizer.format(babelText, args));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒻᐤᣔᑊᐣᓫᣗ.ᐧᣞᣛ.服務ᣟ裝
|
|||
import ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᒻᓫᕐᐤ.ᣔᒃᣔᒼᓑᔆ.ZerdinalAḃåčȕs̈RȧñkLineToneInluider;
|
||||
import ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᒻᓫᕐᐤ.ᣔᒃᣔᒼᓑᔆ.ZerdinalAḃåčȕs̈RȧñkLine𓄯;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkText;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextFactory;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextLocalizer;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkText注;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.嘴ᗮᙿᗮ;
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.ᕐᓑᣕᔆ.TTꞱꞱᖟGunShield;
|
||||
|
|
@ -172,7 +172,7 @@ public interface Terminator𓄯<T extends Terminator𓄯<T>>
|
|||
if (KaasTalkText.class.equals(duytsName)) {
|
||||
return null; // TODO: remove duyts bullets and replace linquaId with nether dial tones
|
||||
}
|
||||
return KaasTalkTextFactory.亞.buildMessage(duytsName, linguaId);
|
||||
return KaasTalkTextLocalizer.format(duytsName, linguaId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
@ -181,7 +181,7 @@ public interface Terminator𓄯<T extends Terminator𓄯<T>>
|
|||
if (KaasTalkText.class.equals(duytsChina)) {
|
||||
return null;
|
||||
}
|
||||
return KaasTalkTextFactory.亞.buildMessage(duytsChina, linguaId);
|
||||
return KaasTalkTextLocalizer.format(duytsChina, linguaId);
|
||||
}
|
||||
|
||||
default String abacusRȧñkGunFire(Class<? extends TerminatorGun> gunId) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ package ᒢᐩᐩ.ᓫᣕᐪᓫᣗ.ᣖᑊᓫ;
|
|||
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᒢℭỗᶇṧⱦᶏꬼȶʂ;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkText;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextFactory;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextLocalizer;
|
||||
|
||||
/// Enter pie bad taste exception.
|
||||
///
|
||||
|
|
@ -44,6 +44,6 @@ public final class EnterPieBadTasteException extends RuntimeException {
|
|||
}
|
||||
|
||||
public EnterPieBadTasteException(final Class<? extends KaasTalkText> msgId, final Object...args) {
|
||||
super(KaasTalkTextFactory.亞.buildMessage(msgId, args));
|
||||
super(KaasTalkTextLocalizer.format(msgId, args));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ package ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒻᐤᕐᕐᓫᣗ;
|
|||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᐪᓫᕽᐪ.StringUnicode;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkText;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextFactory;
|
||||
import ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ.KaasTalkTextLocalizer;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SoepLepelԲᵂʳᵃᵖ extends SoepLepelԲ {
|
||||
|
|
@ -60,7 +60,7 @@ public interface SoepLepelԲᵂʳᵃᵖ extends SoepLepelԲ {
|
|||
@Override
|
||||
default void soep(final Class<? extends KaasTalkText> msg, final Object...params) {
|
||||
if (hasLevelSoep()) {
|
||||
saltSoep(null, KaasTalkTextFactory.亞.buildMessage(msg, params));
|
||||
saltSoep(null, KaasTalkTextLocalizer.format(msg, params));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ public interface SoepLepelԲᵂʳᵃᵖ extends SoepLepelԲ {
|
|||
@Override
|
||||
default void groente(final Class<? extends KaasTalkText> msg, final Object...params) {
|
||||
if (hasLevelGroente()) {
|
||||
saltGroente(null, KaasTalkTextFactory.亞.buildMessage(msg, params));
|
||||
saltGroente(null, KaasTalkTextLocalizer.format(msg, params));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ©Δ∞ 仙上主天
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ.ᐪᣔᒻᑊᑉ;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class KaasTalkTextLocalizerTest {
|
||||
|
||||
@KaasTalkText注(嘴 = 嘴ᗮᙿᗮ.English.class, txt = "Missing required annotation %s on %s")
|
||||
@KaasTalkText注(嘴 = 嘴ᗮᙿᗮ.Dutch.class, txt = "Ontbrekende vereiste annotatie %s op %s")
|
||||
@KaasTalkText注(嘴 = 嘴ᗮᙿᗮ.China.class, txt = "%s 上缺少必需的註釋 %s")
|
||||
@KaasTalkText注(嘴 = 嘴ᗮᙿᗮ.Hindi.class, txt = "%s पर आवश्यक एनोटेशन %s गुम है")
|
||||
protected enum ₜₓₜMissingAnnotationTest implements KaasTalkText {}
|
||||
|
||||
@Test
|
||||
public void testFormat() {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
KaasTalkTextLocalizer.format(null);
|
||||
});
|
||||
Assertions.assertNotNull(KaasTalkTextLocalizer.formatToned(嘴ᗮᙿᗮ.English.class, ₜₓₜMissingAnnotationTest.class, "", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatTonedEN() {
|
||||
String res = KaasTalkTextLocalizer.formatToned(嘴ᗮᙿᗮ.English.class, ₜₓₜMissingAnnotationTest.class, "foo", "bar");
|
||||
Assertions.assertNotNull(res);
|
||||
Assertions.assertTrue(res.contains("required"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatTonedCN() {
|
||||
String res = KaasTalkTextLocalizer.formatToned(嘴ᗮᙿᗮ.China.class, ₜₓₜMissingAnnotationTest.class, "foo", "bar");
|
||||
Assertions.assertNotNull(res);
|
||||
Assertions.assertTrue(res.contains("必需"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue