SudokuFX
Loading...
Searching...
No Matches
fr.softsf.sudokufx.common.enums.I18n Enum Reference

Internationalization (i18n) support. More...

Collaboration diagram for fr.softsf.sudokufx.common.enums.I18n:

Public Member Functions

 I18n ()
 Initializes bundles and binds the locale property to the system default.
String getHostEnvironmentLanguageCode ()
String getLanguage ()
String getValue (final String key)
 Retrieves a translated string from the active bundle.
ReadOnlyObjectProperty< Locale > localeProperty ()
void setLanguageBasedOnTheHostEnvironment ()
 Matches the application language to the host environment.
I18n setLocaleBundle (final String i18n)
 Updates the current bundle and synchronizes the locale property.

Public Attributes

 INSTANCE

Private Attributes

ResourceBundle bundle
final ResourceBundle englishBundle
final ResourceBundle frenchBundle
final ReadOnlyObjectWrapper< Locale > locale
 Observable locale property.

Static Private Attributes

static final Logger LOG = LoggerFactory.getLogger(I18n.class)

Detailed Description

Internationalization (i18n) support.

Manages language resources and locale synchronization through JavaFX properties. Technical Note: Accessing INSTANCE triggers the initialization of JavaFX properties, requiring an active JavaFX Toolkit.

Constructor & Destructor Documentation

◆ I18n()

fr.softsf.sudokufx.common.enums.I18n.I18n ( )

Initializes bundles and binds the locale property to the system default.

Triggers JavaFX Toolkit check via ReadOnlyObjectWrapper.

Member Function Documentation

◆ getHostEnvironmentLanguageCode()

String fr.softsf.sudokufx.common.enums.I18n.getHostEnvironmentLanguageCode ( )
Returns
Host system ISO 639-1 language code.

◆ getLanguage()

String fr.softsf.sudokufx.common.enums.I18n.getLanguage ( )
Returns
Current ISO 639-1 language code ("en", "fr", etc.).

◆ getValue()

String fr.softsf.sudokufx.common.enums.I18n.getValue ( final String key)

Retrieves a translated string from the active bundle.

Parameters
keyResource bundle key.
Returns
The localized value, or a formatted error string if not found.

◆ localeProperty()

ReadOnlyObjectProperty< Locale > fr.softsf.sudokufx.common.enums.I18n.localeProperty ( )
Returns
Read-only observable locale property for UI binding.

◆ setLanguageBasedOnTheHostEnvironment()

void fr.softsf.sudokufx.common.enums.I18n.setLanguageBasedOnTheHostEnvironment ( )

Matches the application language to the host environment.

Defaults to English for any language other than French.

Here is the call graph for this function:

◆ setLocaleBundle()

I18n fr.softsf.sudokufx.common.enums.I18n.setLocaleBundle ( final String i18n)

Updates the current bundle and synchronizes the locale property.

Parameters
i18nLanguage code. "EN" for English, defaults to French otherwise.
Returns
The singleton instance.
Here is the call graph for this function:

Member Data Documentation

◆ bundle

ResourceBundle fr.softsf.sudokufx.common.enums.I18n.bundle
private

◆ englishBundle

final ResourceBundle fr.softsf.sudokufx.common.enums.I18n.englishBundle
private

◆ frenchBundle

final ResourceBundle fr.softsf.sudokufx.common.enums.I18n.frenchBundle
private

◆ INSTANCE

fr.softsf.sudokufx.common.enums.I18n.INSTANCE

◆ locale

final ReadOnlyObjectWrapper<Locale> fr.softsf.sudokufx.common.enums.I18n.locale
private
Initial value:
=
new ReadOnlyObjectWrapper<>(Locale.getDefault())

Observable locale property.

Requires JavaFX Toolkit for instantiation.

◆ LOG

final Logger fr.softsf.sudokufx.common.enums.I18n.LOG = LoggerFactory.getLogger(I18n.class)
staticprivate

The documentation for this enum was generated from the following file:
  • src/main/java/fr/softsf/sudokufx/common/enums/I18n.java