-
Notifications
You must be signed in to change notification settings - Fork 1
Localization
Entry class has StringProperty name for displayed name. We create Binding in a Constructor with help of L10N class;
The L10N class is part of the services package (package org.example.globalgoodsindex.services). It provides methods for handling localization in the application, allowing it to adapt to different languages and regions. The class manages locale settings, loads appropriate resource bundles, and provides methods for fetching localized strings and creating bindings based on the current locale.
Retrieves the current locale set for the application.
- This method simply returns the current locale, which is wrapped in an
ObjectProperty<Locale>. - The
localeproperty can be updated dynamically, and this method reflects the current setting.
- None.
Sets a new locale for the application.
- This method updates the
localeproperty and also changes the default locale of the Java system to the provided locale. - It allows the user to dynamically switch the language of the application at runtime.
- None.
Fetches a localized string for a given key and formats it with optional arguments.
- The method retrieves the localized string associated with the provided key from multiple resource bundles:
countries,products, andui.
- If the key is not found in any of the resource bundles, the method returns
null.
Creates a StringBinding for a localized string based on the given message bundle key.
- This method creates a JavaFX
StringBindingwhich will automatically update whenever the locale changes. - The binding fetches the localized string using the
getmethod.
- None.
Creates a StringBinding for a product's short name.
- This method takes a
Productobject and retrieves its short name by looking up a key in the resource bundles based on the product's database name. - It creates a
StringBindingthat will automatically update if the locale changes.
- None.
Creates a StringBinding for a product's short name.
- This method takes a Product object and retrieves its short name by looking up a key in the resource bundles based on the product's database name.
- It creates a StringBinding that will automatically update if the locale changes.
- None.