Skip to content

v2.0.0

Choose a tag to compare

@mficzel mficzel released this 12 Jul 16:03
· 24 commits to main since this release
5201508

What's Changed

  • FEATURE Chain translations for optional overrides by @mficzel in #16

It is now possible to create translation helpers with multiple csv files. The labels from files at the end of the chain take precedence.

prototype(Vendor.Site:Example) < prototype(Neos.Fusion:Component) {
    @private.i18n = ${CsvPO.create('resource://Vendor.Site/Private/Fusion/TranslationChainExample/Generic.translation.csv', 'resource://Vendor.Site/Private/Fusion/TranslationChainExample/Override.translation.csv')}
}

Combined with the @private syntax from fusion in Neos 8.3 this allows to specify generic translations and allow to optionally pass translation-files that will take precedence.

prototype(Vendor.Package:TranslationChainExample) < prototype(Neos.Fusion:Component) {

    # can be set from outside and is recommended to be null by default
    i18nOverride = 'resource://Vendor.Package/Private/Fusion/TranslationChainExample/Override.translation.csv'

    # combines a predefined translation with one that os passed as props.
    @private {
        i18n = ${CsvPO.create('resource://Vendor.Package/Private/Fusion/TranslationChainExample/Generic.translation.csv', props.i18nOverride)}
    }

    renderer = afx`
        <!-- access single translation -->
        <div>{private.i18n.example}</div>

        <!-- export all translations as json -->
        <div data-translations={Json.stringify(private.i18n.jsonSerialize())}></div>
    `
}

In addition the placeholder syntax was extended to allow passing of numbered arguments directly without wrapping them into an array.

    # translation which replaces the placeholders {0} and {1}
    example1 = ${private.i18n.example('hello', 'world')}

    # as an alternate syntax to the previous way that is still supported
    example2 = ${private.i18n.example(['hello', 'world'])}
  • TASK: add basic linting with phpstan and php codesniffer by @mficzel in #15

A ci chain with php codesniffer and static analysis was added. Alongside the minimal supported versions of flow and php were raised to PHP 8 and Neos 8.

Full Changelog: v1.6.1...v2.0.0