File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed
src/main/java/net/onelitefeather/antiredstoneclockremastered/service/impl Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ package net .onelitefeather .antiredstoneclockremastered .service .impl ;
2+
3+ import net .kyori .adventure .key .Key ;
4+ import net .kyori .adventure .translation .GlobalTranslator ;
5+ import net .kyori .adventure .translation .TranslationRegistry ;
6+ import net .onelitefeather .antiredstoneclockremastered .service .api .TranslationService ;
7+ import net .onelitefeather .antiredstoneclockremastered .translations .PluginTranslationRegistry ;
8+ import org .jetbrains .annotations .NotNull ;
9+
10+ import java .util .Locale ;
11+ import java .util .ResourceBundle ;
12+
13+ @ Deprecated (since = "2.0.13" , forRemoval = true )
14+ public final class LegacyTranslationService implements TranslationService {
15+
16+ private final TranslationRegistry translationRegistry ;
17+
18+ public LegacyTranslationService () {
19+ this .translationRegistry = new PluginTranslationRegistry (TranslationRegistry .create (Key .key ("antiredstoneclockremastered" , "translations" )));
20+ this .translationRegistry .defaultLocale (Locale .US );
21+ }
22+
23+ @ Override
24+ public void registerAll (@ NotNull Locale locale , @ NotNull ResourceBundle bundle , boolean escapeSingleQuotes ) {
25+ this .translationRegistry .registerAll (locale , bundle , escapeSingleQuotes );
26+ }
27+
28+ @ Override
29+ public void registerGlobal () {
30+ GlobalTranslator .translator ().addSource (this .translationRegistry );
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ package net .onelitefeather .antiredstoneclockremastered .service .impl ;
2+
3+ import net .kyori .adventure .key .Key ;
4+ import net .kyori .adventure .text .minimessage .translation .MiniMessageTranslationStore ;
5+ import net .kyori .adventure .translation .GlobalTranslator ;
6+ import net .onelitefeather .antiredstoneclockremastered .service .api .TranslationService ;
7+ import org .jetbrains .annotations .NotNull ;
8+
9+ import java .util .Locale ;
10+ import java .util .ResourceBundle ;
11+
12+ public final class ModernTranslationService implements TranslationService {
13+
14+ private final MiniMessageTranslationStore miniMessageTranslationStore ;
15+
16+ public ModernTranslationService () {
17+ this .miniMessageTranslationStore = MiniMessageTranslationStore .create (Key .key ("antiredstoneclockremastered" , "translations" ));
18+ this .miniMessageTranslationStore .defaultLocale (Locale .US );
19+ }
20+
21+ @ Override
22+ public void registerAll (@ NotNull Locale locale , @ NotNull ResourceBundle bundle , boolean escapeSingleQuotes ) {
23+ this .miniMessageTranslationStore .registerAll (locale , bundle , escapeSingleQuotes );
24+ }
25+
26+ @ Override
27+ public void registerGlobal () {
28+ GlobalTranslator .translator ().addSource (this .miniMessageTranslationStore );
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments