Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
04f6e734
Commit
04f6e734
authored
May 11, 2022
by
Secretboy-SMR
Committed by
Melledy
May 11, 2022
Browse files
fixed language not found prompt
parent
8ad6bda3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/LanguageCommand.java
View file @
04f6e734
...
@@ -44,6 +44,13 @@ public final class LanguageCommand implements CommandHandler {
...
@@ -44,6 +44,13 @@ public final class LanguageCommand implements CommandHandler {
actualLangCode
=
languageInst
.
getLanguageCode
();
actualLangCode
=
languageInst
.
getLanguageCode
();
Grasscutter
.
setLanguage
(
languageInst
);
Grasscutter
.
setLanguage
(
languageInst
);
}
}
if
(!
langCode
.
equals
(
actualLangCode
))
{
// I think there is no necessary to register this in language files
// since this will always be english
CommandHandler
.
sendMessage
(
sender
,
"currently, server does not have that language: "
+
langCode
);
}
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.language.language_changed"
,
actualLangCode
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.language.language_changed"
,
actualLangCode
));
}
}
...
...
src/main/java/emu/grasscutter/utils/Language.java
View file @
04f6e734
...
@@ -125,23 +125,23 @@ public final class Language {
...
@@ -125,23 +125,23 @@ public final class Language {
InputStream
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fileName
);
InputStream
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fileName
);
if
(
file
==
null
)
{
// Provided fallback language.
if
(
file
==
null
)
{
// Provided fallback language.
Grasscutter
.
getLogger
().
warn
(
"Failed to load language file: "
+
fileName
+
", falling back to: "
+
fallback
);
actualLanguageCode
=
fallbackLanguageCode
;
actualLanguageCode
=
fallbackLanguageCode
;
if
(
cachedLanguages
.
containsKey
(
actualLanguageCode
))
{
if
(
cachedLanguages
.
containsKey
(
actualLanguageCode
))
{
return
new
LanguageStreamDescription
(
actualLanguageCode
,
null
);
return
new
LanguageStreamDescription
(
actualLanguageCode
,
null
);
}
}
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fallback
);
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fallback
);
Grasscutter
.
getLogger
().
warn
(
"Failed to load language file: "
+
fileName
+
", falling back to: "
+
fallback
);
}
}
if
(
file
==
null
)
{
// Fallback the fallback language.
if
(
file
==
null
)
{
// Fallback the fallback language.
Grasscutter
.
getLogger
().
warn
(
"Failed to load language file: "
+
fallback
+
", falling back to: en-US.json"
);
actualLanguageCode
=
"en-US"
;
actualLanguageCode
=
"en-US"
;
if
(
cachedLanguages
.
containsKey
(
actualLanguageCode
))
{
if
(
cachedLanguages
.
containsKey
(
actualLanguageCode
))
{
return
new
LanguageStreamDescription
(
actualLanguageCode
,
null
);
return
new
LanguageStreamDescription
(
actualLanguageCode
,
null
);
}
}
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/en-US.json"
);
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/en-US.json"
);
Grasscutter
.
getLogger
().
warn
(
"Failed to load language file: "
+
fallback
+
", falling back to: en-US.json"
);
}
}
if
(
file
==
null
)
if
(
file
==
null
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment