visol/translationapi

API to fetch translation units.

Installs: 3 482

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 8

Forks: 0

Open Issues: 1

Type:typo3-cms-extension

3.0.0 2022-06-17 14:45 UTC

This package is auto-updated.

Last update: 2024-12-20 20:21:45 UTC


README

This extension lets you fetch localized labels from TYPO3. It will automatically export labels as JSON from any locallang.xlf file, given its extension key.

How-To Use within Fluid

This extension is able to export the labels as JSON to be embedded into a HTML snippet:

<div
	xmlns="http://www.w3.org/1999/xhtml" lang="en"
	xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
	xmlns:l10n="http://typo3.org/ns/Sinso/Translationapi/ViewHelpers"
>

    <!-- standard notation -->
    <l10n:exportXliff extensionKey="some-extension" prefix="some-prefix" />

    <!-- inline notation -->
    <section data-localized-days='{l10n:exportXliff(extensionKey:"some-extension", prefix:"some-prefix")}'>
        ...
    </section>

</div>

Options

  • ?omitPrefix=yes (default "no") will strip the prefix from the key. E.g. with "module" as prefix,

    key "module.foo.bar" will be returned as "foo.bar"

  • ?expand=yes (default "no") will "expand" the keys as subarrays:

    {
        "module.foo.bar.key1": "value1",
        "module.foo.bar.key2": "value2",
    }
    

    becomes

    {
        "module": {
            "foo": {
                "bar": {
                    "key1": "value1",
                    "key2": "value2"
                }
            }
        }
    }