Skip to content

0.3.0

Compare
Choose a tag to compare
@ramsey ramsey released this 16 Dec 20:37
· 52 commits to main since this release
0.3.0
faf5a70

Added

  • Add Crowdin as a format for writing and reading extracted messages
  • Add pseudo-locale console command to allow conversion of a locale to one of the supported pseudo-locales (en-XA, en-XB, xx-AC, xx-HA, and xx-LS).
  • Provide --flatten extraction option to tell the extractor to hoist selectors and flatten sentences as much as possible. For example, I have {count, plural, one{a dog} other{many dogs}} becomes {count, plural, one{I have a dog} other{I have many dogs}}. The goal is to provide as many full sentences as possible, since fragmented sentences are not translator-friendly.
  • Provide --validate-messages extraction option to print a list of validation failures and respond with a non-zero exit code on validation failures
  • Provide --add-missing-ids extraction option to update source code with auto-generated identifiers
  • Add Util\FormatHelper that provides getReader() and getWriter() methods
  • Introduce Format\Format final static class for format constants
  • Port @formatjs/icu-messageformat-parser to FormatPHP (FormatPHP\Icu\MessageFormat\Parser)

Changed

  • The Extractor\MessageExtractor constructor now requires Util\FormatHelper as a fifth parameter
  • Remove $config argument from Format\ReaderInterface
  • Remove $localeResolved argument from Format\ReaderInterface
  • Change type on $options argument in Format\WriterInterface from MessageExtractorOptions to a dedicated WriterOptions type
  • The MessageLoader constructor now accepts the following values for the $formatReader parameter:
    • Fully-qualified class name for a class that implements FormatPHP\Format\ReaderInterface
    • An already-instantiated instance object of FormatPHP\Format\ReaderInterface
    • A callable with the shape callable(mixed[]): FormatPHP\MessageCollection
    • The path to a script that returns a callable with this shape

Deprecated

  • Nothing.

Removed

  • Nothing.

Fixed

  • Support rich text formatting in the same manner as FormatJS. Previously, we allowed HTML tags with attributes, etc., but this limits our ability to provide pseudo-locales and validation.