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

Not able to load Custom Locale Translation Strings for i18n languages provided under /apps/core/fd/af-clientlibs/core-forms-components-runtime-all/resources/i18n #1497

Open
shravanthprasad opened this issue Dec 24, 2024 · 7 comments
Labels
answered bug Something isn't working

Comments

@shravanthprasad
Copy link

Expected Behaviour

Should be able to add custom language translation strings using clientlibs like - /apps/forms-core-components-it/clientlibs/clientlib-it-custom-locale/js/languageinit.js

Actual Behaviour

Cannot override translation strings present under core clientlibs - /apps/core/fd/af-clientlibs/core-forms-components-runtime-all/resources/i18n

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

AEM6.5.20

AEM Version (mention the exact version in case of cloud SDK)

AEM6.5.20

AEM Forms Version

1.1.39-enumB010

Sample Code that illustrates the problem

Logs taken while reproducing problem

The following code in


does not let custom translation strings to be loaded as the #langData already has entry for the given locale from ko-kr.json under /apps/core/fd/af-clientlibs/core-forms-components-runtime-all/resources/i18n/ko-kr.json

@rismehta
Copy link
Collaborator

rismehta commented Jan 2, 2025

@shravanthprasad

The process for incorporating a custom locale is documented here:
Custom Locale Documentation.

Additionally, we have an automated test case for this use case (loading custom language specific translation strings) available at the following links:

Language Initialization Script
Locale Test Case

@shravanthprasad
Copy link
Author

@rismehta - we have followed same steps to add custom language initialisation. Issue is happening when we have custom language initialisation for the same lan(ex:ko-kr). Since the above language data(core components) is already loaded, the condition if (!(lang in this.#langData)) { doesn't add our custom language data.

@rismehta
Copy link
Collaborator

rismehta commented Jan 9, 2025

Issue is happening when we have custom language initialisation for the same lan(ex:ko-kr). Since the above language data(core components) is already loaded, the condition if (!(lang in this.#langData)) { doesn't add our custom language data.

Thank you. Could you describe your use case for loading custom strings based on the product locale? It seems we already have a TODO in the code to support this in the future: Link to Code.

@shravanthprasad
Copy link
Author

@rismehta - Two UseCases where we use Rule Editor and Custom Functions to fetch translated string from central location and load it to the form
image

  1. Translated dropdown options
  2. Translated Form Error message

@rismehta rismehta added the bug Something isn't working label Jan 9, 2025
@rismehta
Copy link
Collaborator

rismehta commented Jan 9, 2025

@rismehta - Two UseCases where we use Rule Editor and Custom Functions to fetch translated string from central location and load it to the form image

  1. Translated dropdown options
  2. Translated Form Error message

@shravanthprasad This issue should be addressed via this PR. If you need to override any product locale, the recommended approach is to first copy the existing set of data and then apply your incremental changes on top of it. You can see an example of this approach here: diff of the changes.

To simplify the implementation, it's preferable to maintain a copy of the original and then extend it with custom modifications. While we could potentially merge the JSON from the custom and product configurations, managing priority rules in such a merge would introduce additional complexity.

@rismehta
Copy link
Collaborator

@shravanthprasad The PR has been merged. If you'd like the fix to be applied to version 1.1.39-enumB010, could you please submit a hotfix request through the support channel?

@shravanthprasad
Copy link
Author

Thank you for the quick fix @rismehta - I will get a hotfix request raised

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants