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
137ea1e2
Commit
137ea1e2
authored
May 08, 2022
by
KingRainbow44
Committed by
Melledy
May 08, 2022
Browse files
Fallback to the fallback fallback
parent
09801a18
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/utils/Language.java
View file @
137ea1e2
...
...
@@ -46,12 +46,15 @@ public final class Language {
private
Language
(
String
fileName
,
String
fallback
)
{
@Nullable
JsonObject
languageData
=
null
;
InputStream
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fileName
);
if
(
file
==
null
)
// Provided fallback language.
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fallback
);
if
(
file
==
null
)
// Fallback the fallback language.
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/en-US.json"
);
if
(
file
==
null
)
throw
new
RuntimeException
(
"Unable to load the primary, fallback, and 'en-US' language files."
);
try
{
InputStream
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fileName
);
if
(
file
==
null
)
{
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fallback
);
}
languageData
=
Grasscutter
.
getGsonFactory
().
fromJson
(
Utils
.
readFromInputStream
(
file
),
JsonObject
.
class
);
}
catch
(
Exception
exception
)
{
Grasscutter
.
getLogger
().
warn
(
"Failed to load language file: "
+
fileName
,
exception
);
...
...
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