getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

api/translations/:code does not return custom language variables #3064

Closed renestalder closed 3 years ago

renestalder commented 3 years ago

Describe the bug

As previously discussed in the forum, the api/translations/:code endpoint returns all translations, including plugins, but doesn't return custom language variables as defined in the translations field of e.g. site/languages/de.php.

To Reproduce
Steps to reproduce the behavior:

  1. Define custom language variables in one of your translation files, e.g. site/languages/de.php:

    <?php
    
    return [
        'code' => 'de',
        'default' => true,
        'direction' => 'ltr',
        'locale' => [
            'LC_ALL' => 'de'
        ],
        'name' => 'Deutsch',
        'translations' => [
            'labelname' => 'Name',
            'labelemail' => 'E-Mail',
            'labelresidence' => 'Wohnort',
            'labelquestion' => 'Frage stellen',
            'labelquestionsubmit' => 'Frage einsenden'
        ],
        'url' => ''
    ];
  2. Query the api/translations/de endpoint

Expected behavior
The result set of the API request to include the custom language variables.

Screenshots

Kirby Version

3.5.0

Console output

Desktop (please complete the following information):
Not relevant

Smartphone (please complete the following information):
Not relevant

Additional context

cc @distantnative

bastianallgeier commented 3 years ago

renestalder commented 3 years ago

:cool: :cool: :cool:

Looking forward to that. Already had to write a copy and parser task that moves the translations from the Kirby PHP project over to the decoupled front-end to work around it.

Very appreciated that this already went through the pipeline. Thank you.