From d4dd0567308bec8513d2c23818445fcc3fc372dc Mon Sep 17 00:00:00 2001 From: blue <825657193@qq.com> Date: Sat, 11 Jan 2025 17:43:40 +0000 Subject: [PATCH 1/4] add LICENSE. Signed-off-by: blue <825657193@qq.com> --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c7e6e5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 blue + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 4d243cab17812e3852b084b2e587f4ace8352963 Mon Sep 17 00:00:00 2001 From: blue <825657193@qq.com> Date: Wed, 15 Jan 2025 04:27:41 +0000 Subject: [PATCH 2/4] update README.md. Signed-off-by: blue <825657193@qq.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6abc829..dd44e48 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ #### 介绍 本项目为盒子IM后台管理,主要为盒子IM提供用户管理、群组管理、消息管理、敏感词管理等后台功能。 -建议先把业务服务跑起来,再回来搭建后台服务: +建议先把业务服务跑起来,再回来搭建后台服务: 盒子IM业务仓库地址:https://gitee.com/bluexsx/box-im 详细文档: https://www.yuque.com/u1475064/mufu2a From e8f82c99b8caf5f18be86f5212f9e82efa41ea91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8?= Date: Sun, 23 Feb 2025 04:18:36 +0000 Subject: [PATCH 3/4] =?UTF-8?q?update=20im-admin-ui/src/components/ImageUp?= =?UTF-8?q?load/index.vue.=20=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E5=90=8E?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=B0=86=E5=9B=9E=E8=B0=83emit=E5=88=B0?= =?UTF-8?q?=E7=88=B6=E7=BB=84=E4=BB=B6=EF=BC=8C=E7=88=B6=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E6=AD=A3=E7=A1=AE=E5=A4=84=E7=90=86=E7=BC=A9?= =?UTF-8?q?=E7=95=A5=E5=9B=BE=E7=AD=89=E4=BA=8B=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 老周 --- im-admin-ui/src/components/ImageUpload/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/im-admin-ui/src/components/ImageUpload/index.vue b/im-admin-ui/src/components/ImageUpload/index.vue index 637d42a..1b62739 100644 --- a/im-admin-ui/src/components/ImageUpload/index.vue +++ b/im-admin-ui/src/components/ImageUpload/index.vue @@ -59,7 +59,7 @@ const props = defineProps({ }); const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const emit = defineEmits(['update:modelValue']); +const emit = defineEmits(['update:modelValue', 'on-success']); const dialogImageUrl = ref(''); const dialogVisible = ref(false); @@ -99,6 +99,7 @@ const handleBeforeUpload = (file: any) => { // 上传成功回调 const handleUploadSuccess = (res: any) => { if (res.code === 200) { + emit('on-success', res.data); emit('update:modelValue', res.data.originUrl); } else { emit('update:modelValue', ''); From f4e57b58c38a3041a425f8ac97577a129402a64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8?= Date: Sun, 23 Feb 2025 04:22:46 +0000 Subject: [PATCH 4/4] =?UTF-8?q?update=20I18nLocaleResolver.java.=20content?= =?UTF-8?q?-language=20=E6=98=AF=E4=B8=80=E4=B8=AA=20HTTP=20=E5=A4=B4?= =?UTF-8?q?=E9=83=A8=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=8C=87=E5=AE=9A=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E4=BD=93=E7=9A=84=E8=87=AA=E7=84=B6=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E3=80=82=E5=AE=83=E7=9A=84=E5=80=BC=E9=80=9A=E5=B8=B8=E6=98=AF?= =?UTF-8?q?=E7=94=A8=E9=80=97=E5=8F=B7=E5=88=86=E9=9A=94=E7=9A=84=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E6=A0=87=E7=AD=BE=E5=88=97=E8=A1=A8=EF=BC=88=E4=BE=8B?= =?UTF-8?q?=E5=A6=82=EF=BC=9Azh-CN,en;q=3D0.9=EF=BC=89=E3=80=82=E7=84=B6?= =?UTF-8?q?=E8=80=8C=EF=BC=8CLocale=20=E7=9A=84=E6=9E=84=E9=80=A0=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E9=9C=80=E8=A6=81=E7=9A=84=E6=98=AF=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=92=8C=E5=9B=BD=E5=AE=B6=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=88=E7=94=A8=E4=B8=8B=E5=88=92=E7=BA=BF=20=5F=20=E5=88=86?= =?UTF-8?q?=E9=9A=94=EF=BC=89=E3=80=82=E7=9B=B4=E6=8E=A5=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=20-=20=E5=88=86=E9=9A=94=E7=AC=A6=E5=B9=B6=E6=9E=84=E9=80=A0?= =?UTF-8?q?=20Locale=20=E6=98=AF=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 老周 --- .../common/web/core/I18nLocaleResolver.java | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/im-admin/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/core/I18nLocaleResolver.java b/im-admin/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/core/I18nLocaleResolver.java index 98ddd06..c877cd3 100644 --- a/im-admin/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/core/I18nLocaleResolver.java +++ b/im-admin/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/core/I18nLocaleResolver.java @@ -15,12 +15,35 @@ public class I18nLocaleResolver implements LocaleResolver { @Override public Locale resolveLocale(HttpServletRequest httpServletRequest) { - String language = httpServletRequest.getHeader("content-language"); - Locale locale = Locale.getDefault(); - if (language != null && language.length() > 0) { - String[] split = language.split("_"); - locale = new Locale(split[0], split[1]); + String languageHeader = httpServletRequest.getHeader("content-language"); + Locale locale; + + if (languageHeader != null && !languageHeader.isEmpty()) { + // 处理可能的逗号分隔的语言列表 + String[] languages = languageHeader.split(","); + String preferredLanguage = languages[0]; // 取第一个语言标签作为首选 + + // 处理语言标签的格式(可能包含语言、国家、区域) + String[] parts = preferredLanguage.split("-"); + switch (parts.length) { + case 1: // 只有语言代码 + locale = new Locale(parts[0]); + break; + case 2: // 语言代码和国家代码 + locale = new Locale(parts[0], parts[1]); + break; + case 3: // 语言代码、国家代码和区域代码 + locale = new Locale(parts[0], parts[1], parts[2]); + break; + default: // 默认回退到默认语言环境 + locale = Locale.getDefault(); + break; + } + } else { + // 如果没有 content-language 头部,使用默认语言环境 + locale = Locale.getDefault(); } + return locale; } @@ -28,4 +51,4 @@ public class I18nLocaleResolver implements LocaleResolver { public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) { } -} +} \ No newline at end of file