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

[v4] New translations root #6216

Draft
wants to merge 4 commits into
base: develop-minor
Choose a base branch
from

Conversation

afbora
Copy link
Member

@afbora afbora commented Jan 27, 2024

This PR …

This is K4 version of #6212. Doesn't include a breaking change.

Fixes

Features

  • New translations root
$kirby = new Kirby([
    'roots' => [
        'translations' => __DIR__ . '/site/translations',
    ],
]);

Breaking changes

None

Ready?

  • Unit tests for fixed bug/feature
  • In-code documentation (wherever needed)
  • Tests and checks all pass

For review team

@afbora afbora added type: feature 🎉 Adds a feature (requests → feedback.getkirby.com) needs: tests 🧪 Requires missing tests labels Jan 27, 2024
@afbora afbora requested review from lukasbestle and a team January 27, 2024 17:20
@afbora afbora self-assigned this Jan 27, 2024
@afbora afbora mentioned this pull request Jan 27, 2024
5 tasks
@afbora afbora force-pushed the lab/afbora/new-translations-root-4x branch 2 times, most recently from e3a4ad8 to 984ee0f Compare January 30, 2024 16:54
@afbora afbora added this to the 4.2.0 milestone Feb 1, 2024
@afbora afbora marked this pull request as ready for review February 1, 2024 09:03
src/Cms/Language.php Outdated Show resolved Hide resolved
@distantnative distantnative added the needs: changes 🔁 Implement any requested changes to proceed label Feb 3, 2024
@afbora afbora force-pushed the lab/afbora/new-translations-root-4x branch from 5008f62 to a7df158 Compare February 3, 2024 20:48
@afbora afbora changed the title [v4 ]New translations root [v4] New translations root Feb 3, 2024
@afbora afbora removed the needs: changes 🔁 Implement any requested changes to proceed label Feb 5, 2024
@afbora afbora requested a review from a team February 5, 2024 09:49
@afbora afbora force-pushed the lab/afbora/new-translations-root-4x branch from a7df158 to 296ba48 Compare March 5, 2024 17:41
if ($this->translationsObject()->root() !== null) {
$this->translationsObject()
->save($data['translations'] ?? []);
$data['translations'] = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to even unset it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems setting empty array is correct.

With set empty array:

<?php

return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'en_US'
    ],
    'name' => 'EN',
    'translations' => [

    ],
    'url' => NULL
];

With unseting:

<?php

return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'en_US'
    ],
    'name' => 'EN',
    'url' => NULL
];

src/Cms/LanguageTranslations.php Outdated Show resolved Hide resolved
@afbora afbora force-pushed the lab/afbora/new-translations-root-4x branch from 296ba48 to 1c297d9 Compare March 20, 2024 19:27
@afbora afbora force-pushed the lab/afbora/new-translations-root-4x branch from af8afd6 to b713cd0 Compare March 21, 2024 09:02
@afbora
Copy link
Member Author

afbora commented Mar 21, 2024

I didn't understand the unit test coverage.

For ex: I added LanguageTranslations::get tests with @covers notation but shows still uncovered.

Changes:
https://github.com/getkirby/kirby/pull/6216/files#diff-4e3a14d5dc988b6b8165c6ab49bbe0a32cf21c4c141054da017fe0730e83bf5aR54-R82

Codecov:
https://app.codecov.io/gh/getkirby/kirby/pull/6216/blob/src/Cms/LanguageTranslations.php#L34

@bastianallgeier bastianallgeier modified the milestones: 4.2.0, 4.2.x Mar 27, 2024
@distantnative distantnative modified the milestones: 4.3.x, 4.4.0 Jun 1, 2024
@distantnative distantnative marked this pull request as draft June 1, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: tests 🧪 Requires missing tests type: feature 🎉 Adds a feature (requests → feedback.getkirby.com)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants