Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
d43f4315
Commit
d43f4315
authored
3 years ago
by
KingRainbow44
Committed by
Melledy
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add warning for language fallback
parent
137ea1e2
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/emu/grasscutter/Config.java
+0
-1
0 additions, 1 deletion
src/main/java/emu/grasscutter/Config.java
src/main/java/emu/grasscutter/utils/Language.java
+7
-3
7 additions, 3 deletions
src/main/java/emu/grasscutter/utils/Language.java
with
7 additions
and
4 deletions
src/main/java/emu/grasscutter/Config.java
+
0
−
1
View file @
d43f4315
...
...
@@ -16,7 +16,6 @@ public final class Config {
public
String
KEY_FOLDER
=
"./keys/"
;
public
String
SCRIPTS_FOLDER
=
"./resources/Scripts/"
;
public
String
PLUGINS_FOLDER
=
"./plugins/"
;
public
String
LANGUAGE_FOLDER
=
"./languages/"
;
public
ServerDebugMode
DebugMode
=
ServerDebugMode
.
NONE
;
// ALL, MISSING, NONE
public
ServerRunMode
RunMode
=
ServerRunMode
.
HYBRID
;
// HYBRID, DISPATCH_ONLY, GAME_ONLY
...
...
This diff is collapsed.
Click to expand it.
src/main/java/emu/grasscutter/utils/Language.java
+
7
−
3
View file @
d43f4315
...
...
@@ -19,7 +19,7 @@ public final class Language {
* @return A language instance.
*/
public
static
Language
getLanguage
(
String
langCode
)
{
return
new
Language
(
langCode
+
".json"
,
Grasscutter
.
getConfig
().
DefaultLanguage
.
toLanguageTag
());
return
new
Language
(
langCode
+
".json"
,
Grasscutter
.
getConfig
().
DefaultLanguage
.
toLanguageTag
()
+
".json"
);
}
/**
...
...
@@ -47,10 +47,14 @@ public final class Language {
@Nullable
JsonObject
languageData
=
null
;
InputStream
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fileName
);
if
(
file
==
null
)
// Provided fallback language.
if
(
file
==
null
)
{
// Provided fallback language.
file
=
Grasscutter
.
class
.
getResourceAsStream
(
"/languages/"
+
fallback
);
if
(
file
==
null
)
// Fallback the fallback language.
Grasscutter
.
getLogger
().
warn
(
"Failed to load language file: "
+
fileName
+
", falling back to: "
+
fallback
);
}
if
(
file
==
null
)
{
// Fallback the fallback language.
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
)
throw
new
RuntimeException
(
"Unable to load the primary, fallback, and 'en-US' language files."
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment