Skip to content

io microsphere i18n ServiceMessageSource

github-actions[bot] edited this page Jul 9, 2026 · 12 revisions

ServiceMessageSource

Type: Interface | Module: microsphere-i18n-core | Package: io.microsphere.i18n | Since: 1.0.0

Source: microsphere-i18n-core/src/main/java/io/microsphere/i18n/ServiceMessageSource.java

Overview

Service internationalization message source.

Example Usage

`ServiceMessageSource source = new DefaultServiceMessageSource("test");
  source.init();
  // Get message in default locale (e.g. Simplified Chinese)
  String msg = source.getMessage("a"); // "测试-a"
  // Get message in a specific locale
  String engMsg = source.getMessage("hello", Locale.ENGLISH, "World"); // "Hello,World"
  source.destroy();
`

Declaration

public interface ServiceMessageSource extends Prioritized

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.17-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

ServiceMessageSource source = new DefaultServiceMessageSource("test");
  source.init();
  // Get message in default locale (e.g. Simplified Chinese)
  String msg = source.getMessage("a"); // "测试-a"
  // Get message in a specific locale
  String engMsg = source.getMessage("hello", Locale.ENGLISH, "World"); // "Hello,World"
  source.destroy();

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-i18n-core</artifactId>
    <version>${microsphere-i18n.version}</version>
</dependency>

Tip: Use the BOM (microsphere-i18n-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.i18n.ServiceMessageSource;

This documentation was auto-generated from the source code of microsphere-i18n.

Clone this wiki locally