Skip to content

Conversation

@Kovy95
Copy link

@Kovy95 Kovy95 commented Oct 23, 2025

Description

-export i18n as cdata section and import it same way

Fixes [NAB-388]

Dependencies

none

Third party dependencies

  • No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

manually

Test Configuration

<Please describe configuration for tests to run if applicable, like program parameters, host OS, VM configuration etc.>

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked with @...
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

-export i18n as cdata section and import it same way
@Kovy95 Kovy95 self-assigned this Oct 23, 2025
Copy link
Contributor

@mazarijuraj mazarijuraj left a comment

Choose a reason for hiding this comment

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

Update test model petriflow_test.xml and 'should import & export' in petriflow.spec.js to test that i18n with html code is correctly imported and exported

-add cdata to test file to i18ns and add it to test
@Kovy95 Kovy95 requested a review from mazarijuraj October 24, 2025 10:55
</data>
<data type="text">
<id>newVariable_22</id>
<title>HTML no translation</title>
Copy link
Contributor

Choose a reason for hiding this comment

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

Deceptive title, this HTML area has translations ...

Copy link
Author

Choose a reason for hiding this comment

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

done

expect(i18nLocale.getI18n(i)).not.toBeUndefined();
expect(i18nLocale.getI18n(i).value).toEqual(`${locale.toUpperCase()}_${i}`);
});
expect(i18nLocale.getI18n(TEST_HTML).value).toEqual(`<h2>${locale.toUpperCase()}_Title</h2>`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Better way would be to add another list as argument that would be ids of i18ns that should match not by .toEqaul() but by contains. This way you could simply put:

expect(i18nLocale.getI18ns().length).toEqual(i18ns_equal.length + i18ns_contain.length);
...
i18ns_equal.forEach( ... );
i18ns_contain.forEach( ... );

Copy link
Author

Choose a reason for hiding this comment

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

done

function assertI18n(locale, i18ns, model) {
const i18nLocale = model.getI18n(locale);
expect(i18nLocale.getI18ns().length).toEqual(i18ns.length);
expect(i18nLocale.getI18ns().length).toEqual(i18ns.length + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

This +1 has very poor readability. See the next comment for better solution

Copy link
Author

Choose a reason for hiding this comment

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

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants