diff --git a/broker/config/i18n/messages.properties b/broker/config/i18n/messages.properties deleted file mode 100644 index e65697c1..00000000 --- a/broker/config/i18n/messages.properties +++ /dev/null @@ -1,3 +0,0 @@ -#native2ascii -encoding UTF-8 messages.properties temp_messages.properties -Above_Greeting_Message=\u4ee5\u4e0a\u662f\u6253\u62db\u547c\u4fe1\u606f -Friend_Can_Start_Chat=\u4f60\u4eec\u5df2\u7ecf\u6210\u4e3a\u597d\u53cb\u4e86\uff0c\u73b0\u5728\u53ef\u4ee5\u5f00\u59cb\u804a\u5929\u4e86 diff --git a/broker/config/i18n/messages_en.properties b/broker/config/i18n/messages_en.properties deleted file mode 100644 index cd14274b..00000000 --- a/broker/config/i18n/messages_en.properties +++ /dev/null @@ -1,2 +0,0 @@ -Above_Greeting_Message=This's the greeting -Friend_Can_Start_Chat=You're already friend, start chat now. diff --git a/broker/config/i18n/messages_en_US.properties b/broker/config/i18n/messages_en_US.properties deleted file mode 100644 index cd14274b..00000000 --- a/broker/config/i18n/messages_en_US.properties +++ /dev/null @@ -1,2 +0,0 @@ -Above_Greeting_Message=This's the greeting -Friend_Can_Start_Chat=You're already friend, start chat now. diff --git a/broker/config/i18n/messages_zh.properties b/broker/config/i18n/messages_zh.properties deleted file mode 100644 index cc223829..00000000 --- a/broker/config/i18n/messages_zh.properties +++ /dev/null @@ -1,2 +0,0 @@ -Above_Greeting_Message=\u4ee5\u4e0a\u662f\u6253\u62db\u547c\u4fe1\u606f -Friend_Can_Start_Chat=\u4f60\u4eec\u5df2\u7ecf\u6210\u4e3a\u597d\u53cb\u4e86\uff0c\u73b0\u5728\u53ef\u4ee5\u5f00\u59cb\u804a\u5929\u4e86 diff --git a/broker/config/i18n/messages_zh_CN.properties b/broker/config/i18n/messages_zh_CN.properties deleted file mode 100644 index cc223829..00000000 --- a/broker/config/i18n/messages_zh_CN.properties +++ /dev/null @@ -1,2 +0,0 @@ -Above_Greeting_Message=\u4ee5\u4e0a\u662f\u6253\u62db\u547c\u4fe1\u606f -Friend_Can_Start_Chat=\u4f60\u4eec\u5df2\u7ecf\u6210\u4e3a\u597d\u53cb\u4e86\uff0c\u73b0\u5728\u53ef\u4ee5\u5f00\u59cb\u804a\u5929\u4e86 diff --git a/broker/config/wildfirechat.conf b/broker/config/wildfirechat.conf index 16d93c0a..136649b1 100755 --- a/broker/config/wildfirechat.conf +++ b/broker/config/wildfirechat.conf @@ -142,12 +142,6 @@ friend.reject_request_duration 2592000000 ##好友请求过期时间,单位是毫秒,默认是7天,0为无限长期限。 friend.request_expiration_duration 604800000 -##添加好友后会发送欢迎消息,比如"你们已经是好友了,可以聊天了"。这个开关控制是用旧的方式还是用新的方式。 -##旧的方式会发送notification消息(contenttype是80),内容会根据好友接收者的语言选择对应的语言,如果双方语言不一致会导致另外一方看到的不是本地语言。 -##新的方式会发送添加好友消息(contenttype是93)和欢迎消息(contenttype是92),需要客户端实现这两种消息。 -##如果客户端已经实现这两种消息可以打开这个开关(客户端2020.6.30添加了此消息类型)。 -friend.new_welcome_message true - ## 聊天室观众空闲退出时间,单位为毫秒,默认为15分钟,0为永远不退出 chatroom.participant_idle_time 900000 diff --git a/broker/src/main/java/io/moquette/BrokerConstants.java b/broker/src/main/java/io/moquette/BrokerConstants.java index e25ee747..ec6218b4 100755 --- a/broker/src/main/java/io/moquette/BrokerConstants.java +++ b/broker/src/main/java/io/moquette/BrokerConstants.java @@ -156,7 +156,6 @@ public final class BrokerConstants { public static final String FRIEND_Repeat_Request_Duration = "friend.repeat_request_duration"; public static final String FRIEND_Reject_Request_Duration = "friend.reject_request_duration"; public static final String FRIEND_Request_Expiration_Duration = "friend.request_expiration_duration"; - public static final String FRIEND_New_Welcome_Message = "friend.new_welcome_message"; public static final String CHATROOM_Participant_Idle_Time = "chatroom.participant_idle_time"; public static final String CHATROOM_Rejoin_When_Active = "chatroom.rejoin_when_active"; diff --git a/broker/src/main/java/io/moquette/imhandler/HandleFriendRequestHandler.java b/broker/src/main/java/io/moquette/imhandler/HandleFriendRequestHandler.java index 4e5b5355..3a543996 100644 --- a/broker/src/main/java/io/moquette/imhandler/HandleFriendRequestHandler.java +++ b/broker/src/main/java/io/moquette/imhandler/HandleFriendRequestHandler.java @@ -10,12 +10,10 @@ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; -import io.moquette.persistence.MemorySessionStore; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import io.netty.util.internal.StringUtil; -import win.liyufan.im.I18n; import win.liyufan.im.IMTopic; import win.liyufan.im.MessageShardingUtil; @@ -43,17 +41,8 @@ public class HandleFriendRequestHandler extends IMHandler bundleMap = new ConcurrentHashMap<>(); - - public static String getString(String language, String key) { - ResourceBundle bundle = bundleMap.get(language); - - if (StringUtil.isNullOrEmpty(language)) language = "zh_CN"; - - if (bundle == null) { - bundle = ResourceBundle.getBundle("messages", new Locale(language), Loader); - bundleMap.put(language, bundle); - } - - try { - return bundle.getString(key); - } catch (Exception e) { - e.printStackTrace(); - } - return "糟糕,字符串 " + key + " 没有找到"; - } - - public static void test() throws MalformedURLException { - - // 设置定制的语言国家代码 - Locale locale1 = new Locale("zh"); - Locale locale2 = new Locale("en"); - ResourceBundle rb = ResourceBundle.getBundle("messages", locale1, Loader); - - - - // 获得相应的key值 - String greeting = rb.getString("Above_Greeting_Message"); - String userInfo = rb.getString("Friend_Can_Start_Chat"); - - System.out.println(greeting); - System.out.println(userInfo); - } - - public static void main(String[] args) throws Exception { - test(); - } -} diff --git a/distribution/src/main/assembly/assembly.xml b/distribution/src/main/assembly/assembly.xml index e6cfd363..5b829ee1 100755 --- a/distribution/src/main/assembly/assembly.xml +++ b/distribution/src/main/assembly/assembly.xml @@ -20,11 +20,6 @@ /migrate/h2 - - ../broker/config/i18n/ - /config/i18n - - src/main/resources/ config/ diff --git a/distribution/src/main/resources/wildfirechat.conf b/distribution/src/main/resources/wildfirechat.conf index 565ec57d..2ffa218e 100755 --- a/distribution/src/main/resources/wildfirechat.conf +++ b/distribution/src/main/resources/wildfirechat.conf @@ -139,12 +139,6 @@ friend.reject_request_duration 2592000000 ##好友请求过期时间,单位是毫秒,默认是7天,0为无限长期限。 friend.request_expiration_duration 604800000 -##添加好友后会发送欢迎消息,比如"你们已经是好友了,可以聊天了"。这个开关控制是用旧的方式还是用新的方式。 -##旧的方式会发送notification消息(contenttype是80),内容会根据好友接收者的语言选择对应的语言,如果双方语言不一致会导致另外一方看到的不是本地语言。 -##新的方式会发送添加好友消息(contenttype是93)和欢迎消息(contenttype是92),需要客户端实现这两种消息。 -##如果客户端已经实现这两种消息可以打开这个开关(客户端2020.6.30添加了此消息类型)。 -friend.new_welcome_message true - ## 聊天室观众空闲退出时间,单位为毫秒,默认为15分钟,0为永远不退出 chatroom.participant_idle_time 900000