当前位置: 代码网 > it编程>编程语言>Java > Idea国际化

Idea国际化

2024年08月03日 Java 我要评论
进入setting,file encoding,勾选Transparent native-to-ascii conversion。IntelliJ IDEA 中默认的properties文件是GBK编码。修改properties的默认编码,统一为UTF-8。中文生效的messages_zh_CN.properties;英文生效的messages_en_US.properties;在resources新建一个文件用来存放国际化配置;默认生效的messages.properties。

1、解决 intellij idea 中 i18n国际化 中文乱码问题。

intellij idea 中默认的properties文件是gbk编码。修改properties的默认编码,统一为utf-8。

file encodings -> default encoding for properties file -> utf-8

2、idea国际化中文properties内容显示

使用idea工具开发国际化功能时,如果未对properties文件进行设置,则中文内容会显示为类似下面的格式:

进入setting,file encoding,勾选transparent native-to-ascii conversion。

3、国际化配置操作

在resources新建一个文件用来存放国际化配置;

默认生效的messages.properties
中文生效的messages_zh_cn.properties;
英文生效的messages_en_us.properties;

  • 2、点击messages.properties,然后点击下边如图所示的resource bundle的按钮,切换编辑模式:
  • 如果找不到resource bundle 按钮就去settings中  plugins 中下载一个插件:resource bundle editor
  • 完美。
(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com