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
08c01ab1
Commit
08c01ab1
authored
May 05, 2022
by
Secretboy
Committed by
Melledy
May 04, 2022
Browse files
Update Grasscutter.java
parent
6fc4065f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/Grasscutter.java
View file @
08c01ab1
...
...
@@ -6,6 +6,7 @@ import java.io.FileWriter;
import
java.io.IOError
;
import
java.net.InetSocketAddress
;
import
java.util.Calendar
;
import
java.util.Locale
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.plugin.PluginManager
;
...
...
@@ -144,12 +145,12 @@ public final class Grasscutter {
}
public
static
void
loadLanguage
()
{
try
(
FileReader
file
=
new
FileReader
(
String
.
format
(
"%s%s.json"
,
getConfig
().
LANGUAGE_FOLDER
,
Grasscutter
.
config
.
Language
)))
{
try
(
FileReader
file
=
new
FileReader
(
String
.
format
(
"%s%s.json"
,
getConfig
().
LANGUAGE_FOLDER
,
Grasscutter
.
config
.
Locale
Language
)))
{
language
=
gson
.
fromJson
(
file
,
Language
.
class
);
}
catch
(
Exception
e
)
{
Grasscutter
.
language
=
new
Language
();
Grasscutter
.
cn_language
=
new
CNLanguage
();
Grasscutter
.
config
.
Language
=
"en_us"
;
Grasscutter
.
config
.
Locale
Language
=
Locale
.
getDefault
()
;
saveConfig
();
try
{
...
...
@@ -161,15 +162,22 @@ public final class Grasscutter {
}
catch
(
Exception
ee
)
{
Grasscutter
.
getLogger
().
error
(
"Unable to create language folder."
);
}
try
(
FileWriter
file
=
new
FileWriter
(
"./languages/
en_us
.json"
))
{
try
(
FileWriter
file
=
new
FileWriter
(
"./languages/
"
+
Locale
.
US
+
"
.json"
))
{
file
.
write
(
gson
.
toJson
(
language
));
}
catch
(
Exception
ee
)
{
Grasscutter
.
getLogger
().
error
(
"Unable to create language file."
);
}
try
(
FileWriter
file
=
new
FileWriter
(
"./languages/
zh_cn
.json"
))
{
try
(
FileWriter
file
=
new
FileWriter
(
"./languages/
"
+
Locale
.
SIMPLIFIED_CHINESE
+
"
.json"
))
{
file
.
write
(
gson
.
toJson
(
cn_language
));
}
catch
(
Exception
ee
)
{
Grasscutter
.
getLogger
().
error
(
"无法创建中文语言文件。"
);
Grasscutter
.
getLogger
().
error
(
"无法创建简体中文语言文件。"
);
}
// try again
try
(
FileReader
file
=
new
FileReader
(
String
.
format
(
"%s%s.json"
,
getConfig
().
LANGUAGE_FOLDER
,
Grasscutter
.
config
.
LocaleLanguage
)))
{
language
=
gson
.
fromJson
(
file
,
Language
.
class
);
}
catch
(
Exception
ee
)
{
Grasscutter
.
getLogger
().
error
(
"Unable to load "
+
Grasscutter
.
config
.
LocaleLanguage
+
".json"
);
}
}
}
...
...
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