春季启动国际化消息文件名结构

发布于 2025-01-28 04:35:49 字数 350 浏览 3 评论 0原文

Spring Boot允许您通过设置Basename,然后进行一个语言环境来自定义消息属性文件,例如消息。Properties和 Message_de.properties

我想在这些文件中添加后缀,例如 message_de_file1.properties

有没有一种方法来自定义使用此文件结构。 甚至更好,例如 /I18n/en/messages.properties /i18n/de/messages.properties

我需要这样做的原因是因为我需要与之合作的自动翻译服务提供商。

Spring boot allows you to customize message properties files by setting a basename followed by a the locale for example messages.properties and messages_de.properties.

I want to add a suffix to these files for example messages_de_file1.properties.

Is there a way to customize to use this file structure.
Or even better for example /i18n/en/messages.properties and /i18n/de/messages.properties.

The reason I need to do this is because of the automated translation service provider I am required to work with.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提赋 2025-02-04 04:35:49

有一个财产:

spring.messages.basename支持逗号分隔的位置列表,即包装预选赛或从classpath root解决的资源。

spring.messages.basename=i18n/en,i18n/de

There's a property for that:

spring.messages.basename supports comma-separated list of locations, either a package qualifier or a resource resolved from the classpath root.

(https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.internationalization)

So you can do something like

spring.messages.basename=i18n/en,i18n/de
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文