Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using i18n of releases/builds #498

Closed
skreutzer opened this issue Feb 14, 2015 · 4 comments · Fixed by #911
Closed

Using i18n of releases/builds #498

skreutzer opened this issue Feb 14, 2015 · 4 comments · Fixed by #911
Labels
type: improvement The issue suggests an improvement of an existing feature
Milestone

Comments

@skreutzer
Copy link
Contributor

How can the i18n of releases/builds be used? Neither the readme nor the Wiki nor the --help command line argument seem to give a hint how to switch to another language.

@tofi86
Copy link
Collaborator

tofi86 commented Feb 14, 2015

This isn't supported officially yet...

But You can set it on the command line via JVM parameters:

java -Duser.country=DE -Duser.language=de -jar epubcheck.jar ...

@pettarin
Copy link

Perhaps a --language (or --lang or whatever) command line parameter would be adequate. If not specified, the tool should use the current locale as it does now (which can be specified via -Duser.language=xx).

@tofi86
Copy link
Collaborator

tofi86 commented Feb 16, 2015

Good idea! :)

@tofi86 tofi86 added the type: improvement The issue suggests an improvement of an existing feature label Jan 2, 2017
@tofi86
Copy link
Collaborator

tofi86 commented Jan 2, 2017

This will probably be implemented with PR #650 in near future.

rdeltour pushed a commit that referenced this issue Nov 24, 2018
The locale used by EPUBCheck can now be configured:

- with a `--locale` option on the command line
- with the `setLocale(Locale locale)` method on the `EpubCheck` class
- when no locale is provided, the library will fall back to the default
  JVM Locale (i.e. EPUBCheck’s behavior doesn’t change)

This PR introduces the following changes:

- Refactored `com.adobe.epubcheck.util.Messages`:
  - new static `getInstance(…)` methods to get the `Messages` instance
    for the given (optional) locale and class name (used to resolve
    the name of the underlying `ResourceBundle`).
  - the `Messages` instances are cached in a table, keyed with locale
    codes and resource bundle names.
- Refactored the `com.adobe.epubcheck.message` package:
  - `MessageDictionary` is now an interface; it's functionality is split
    in several classes to handle default messages, loading of override
    files, overridden messages, dumping message files, and severities.
  - messages and severities are cached.
- Refactored the `org.idpf.epubcheck.util.css` package, to make it
  locale-aware:
    - a `Locale` is given as an argument to the `CSSParser` constructor
    - the package `Messages` class is removed, replaced by the main
      `com.adobe.epubcheck.util.Messages`
- New `LocalizedReport` interface, extending the `Report` interface with
  locale getter/setter methods, representing a localizable report.
  - the existing `Report` interface is kept unchanged, for backwards
    compatibility
  - `MasterReport` implements this new `LocalizedReport` interface
  - the localization code checks if the underlying report is an instance
    of `LocalizedReport` before setting a new locale.
- New `LocaleHolder` facility to statically store the "current" locale
  in a thread-local variable. This is used by libraries that cannot be
  configured dynamically with a new locale (like Jing).
- Monkey-patch Jing's `Localizer` class to load Jing's resource bundles
  for the locale exposed in the `LocaleHolder` utility.
- Expose the current locale in the `ValidationContext` class
- Update the java sources compatibility version to 1.7
- New locale-related tests

Limitations:

- Jing's localization relies on the locale information exposed in a
static thread-local variable (in the `LocaleHolder` class). Any new
implementations of the `LocalizedReport` must make sure that the locale
stored in the `LocaleHolder` is updated when the locale is changed or
initialized.
- The validation messages defined in the schematron schemas are still
not localized.

Thanks to @matthew-macgregor for the original PR contribution (#650)!

Closes #650
Fixes #498
rdeltour pushed a commit that referenced this issue Nov 25, 2018
The locale used by EPUBCheck can now be configured:

- with a `--locale` option on the command line
- with the `setLocale(Locale locale)` method on the `EpubCheck` class
- when no locale is provided, the library will fall back to the default
  JVM Locale (i.e. EPUBCheck’s behavior doesn’t change)

This PR introduces the following changes:

- Refactored `com.adobe.epubcheck.util.Messages`:
  - new static `getInstance(…)` methods to get the `Messages` instance
    for the given (optional) locale and class name (used to resolve
    the name of the underlying `ResourceBundle`).
  - the `Messages` instances are cached in a table, keyed with locale
    codes and resource bundle names.
- Refactored the `com.adobe.epubcheck.message` package:
  - `MessageDictionary` is now an interface; it's functionality is split
    in several classes to handle default messages, loading of override
    files, overridden messages, dumping message files, and severities.
  - messages and severities are cached.
- Refactored the `org.idpf.epubcheck.util.css` package, to make it
  locale-aware:
    - a `Locale` is given as an argument to the `CSSParser` constructor
    - the package `Messages` class is removed, replaced by the main
      `com.adobe.epubcheck.util.Messages`
- New `LocalizedReport` interface, extending the `Report` interface with
  locale getter/setter methods, representing a localizable report.
  - the existing `Report` interface is kept unchanged, for backwards
    compatibility
  - `MasterReport` implements this new `LocalizedReport` interface
  - the localization code checks if the underlying report is an instance
    of `LocalizedReport` before setting a new locale.
- New `LocaleHolder` facility to statically store the "current" locale
  in a thread-local variable. This is used by libraries that cannot be
  configured dynamically with a new locale (like Jing).
- Monkey-patch Jing's `Localizer` class to load Jing's resource bundles
  for the locale exposed in the `LocaleHolder` utility.
- Expose the current locale in the `ValidationContext` class
- Update the java sources compatibility version to 1.7
- New locale-related tests

Limitations:

- Jing's localization relies on the locale information exposed in a
static thread-local variable (in the `LocaleHolder` class). Any new
implementations of the `LocalizedReport` must make sure that the locale
stored in the `LocaleHolder` is updated when the locale is changed or
initialized.
- The validation messages defined in the schematron schemas are still
not localized.

Thanks to @matthew-macgregor for the original PR contribution (#650)!

Closes #650
Fixes #498
@tofi86 tofi86 added this to the 4.1.0 milestone Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement The issue suggests an improvement of an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants