-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐳 #376 Partial i18n of business framework
- Loading branch information
Showing
17 changed files
with
273 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
common/common-core/src/main/java/com/iohao/game/action/skeleton/i18n/Bundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* ioGame | ||
* Copyright (C) 2021 - present 渔民小镇 ([email protected]、[email protected]) . All Rights Reserved. | ||
* # iohao.com . 渔民小镇 | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.iohao.game.action.skeleton.i18n; | ||
|
||
import lombok.experimental.UtilityClass; | ||
|
||
import java.text.MessageFormat; | ||
import java.util.Locale; | ||
import java.util.Objects; | ||
import java.util.ResourceBundle; | ||
|
||
/** | ||
* @author 渔民小镇 | ||
* @date 2024-10-02 | ||
* @since 21.18 | ||
*/ | ||
@UtilityClass | ||
public final class Bundle { | ||
final String baseName = "iohao"; | ||
ResourceBundle bundle; | ||
|
||
ResourceBundle getBundle() { | ||
if (Objects.isNull(bundle)) { | ||
bundle = ResourceBundle.getBundle(baseName, Locale.getDefault()); | ||
} | ||
|
||
return bundle; | ||
} | ||
|
||
public String getMessage(String key) { | ||
return getBundle().getString(key); | ||
} | ||
|
||
public String getMessage(String key, Object... args) { | ||
var keyPattern = getBundle().getString(key); | ||
return MessageFormat.format(keyPattern, args); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
common/common-core/src/main/java/com/iohao/game/action/skeleton/i18n/MessageKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* ioGame | ||
* Copyright (C) 2021 - present 渔民小镇 ([email protected]、[email protected]) . All Rights Reserved. | ||
* # iohao.com . 渔民小镇 | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.iohao.game.action.skeleton.i18n; | ||
|
||
/** | ||
* @author 渔民小镇 | ||
* @date 2024-10-02 | ||
* @since 21.18 | ||
*/ | ||
public interface MessageKey { | ||
String cmdName = "cmdName"; | ||
String gameExternalServer = "gameExternalServer"; | ||
/** ExternalJoinEnum */ | ||
String connectionWay = "connectionWay"; | ||
|
||
/* see PrintActionKit.java */ | ||
String printActionKitPrintClose = "printActionKitPrintClose"; | ||
String printActionKitPrintFull = "printActionKitPrintFull"; | ||
String printActionKitDataCodec = "printActionKitDataCodec"; | ||
String printActionKitCheckReturnType = "printActionKitCheckReturnType"; | ||
|
||
/* see DebugInOut.java */ | ||
String debugInOutThreadName = "debugInOutThreadName"; | ||
String debugInOutParamName = "debugInOutParamName"; | ||
String debugInOutReturnData = "debugInOutReturnData"; | ||
String debugInOutErrorCode = "debugInOutErrorCode"; | ||
String debugInOutErrorMsg = "debugInOutErrorMsg"; | ||
String debugInOutTime = "debugInOutTime"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# common | ||
gameExternalServer=GameExternalServer | ||
cmdName=Routing | ||
# ExternalJoinEnum | ||
connectionWay=Connection way | ||
# see PrintActionKit.java | ||
printActionKitPrintClose=To turn off printing, see | ||
printActionKitPrintFull=Print the full package name, see | ||
printActionKitDataCodec=DataCodec | ||
printActionKitCheckReturnType=Action return values and parameters do not support set, map and basic types! | ||
# see DebugInOut.java | ||
debugInOutThreadName=Thread | ||
debugInOutParamName=RequestParam | ||
debugInOutReturnData=ResponseData | ||
debugInOutErrorCode=ErrorCode | ||
debugInOutErrorMsg=ErrorMsg | ||
debugInOutTime=ExecutionTime |
17 changes: 17 additions & 0 deletions
17
common/common-core/src/main/resources/iohao_zh_CN.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# common | ||
gameExternalServer=\u6E38\u620F\u5BF9\u5916\u670D | ||
cmdName=\u8DEF\u7531 | ||
# ExternalJoinEnum | ||
connectionWay=\u8FDE\u63A5\u65B9\u5F0F | ||
# see PrintActionKit.java | ||
printActionKitPrintClose=\u5173\u95ED\u6253\u5370, \u67E5\u770B | ||
printActionKitPrintFull=\u6253\u5370\u5B8C\u6574\u5305\u540D, \u67E5\u770B | ||
printActionKitDataCodec=\u5F53\u524D\u4F7F\u7528\u7684\u7F16\u89E3\u7801\u5668 | ||
printActionKitCheckReturnType=action \u8FD4\u56DE\u503C\u548C\u53C2\u6570\u4E0D\u652F\u6301 set\u3001map \u548C \u57FA\u7840\u7C7B\u578B! | ||
# see DebugInOut.java | ||
debugInOutThreadName=\u7EBF\u7A0B | ||
debugInOutParamName=\u53C2\u6570 | ||
debugInOutReturnData=\u54CD\u5E94 | ||
debugInOutErrorCode=\u9519\u8BEF\u7801 | ||
debugInOutErrorMsg=\u9519\u8BEF\u4FE1\u606F | ||
debugInOutTime=\u8017\u65F6 |
Oops, something went wrong.