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

partial translation with custom i18n namespase #738

Closed
5 tasks done
someusersomeuser opened this issue Aug 9, 2022 · 4 comments
Closed
5 tasks done

partial translation with custom i18n namespase #738

someusersomeuser opened this issue Aug 9, 2022 · 4 comments

Comments

@someusersomeuser
Copy link
Contributor

Describe the bug

with custom namespace some items in menu not translated - duplicate namespace in key string

@slickgrid-universal\common\dist\esm\extensions\extensionUtility.js -> translateMenuItemsFromTitleKey(items)

this method add translationPrefix to item.titleKey before translate, but titleKey already contains translationPrefix:

@slickgrid-universal\common\dist\esm\extensions\slickGridMenu.js -> addGridMenuCustomCommands(originalCommandItems)

fix translateMenuItemsFromTitleKey to remove duplicate translationPrefix, or check, that the titleKey not already starts with translationPrefix

Reproduction

  1. set gridOptions.translationNamespace = 'aurelia-slickgrid'
  2. load i18n translations for grid to this namespace

Environment Info

aurelia 1
@slickgrid-universal/common@1.3.7
typescript none
browsers any
os any

Validations

@ghiscoding
Copy link
Owner

Pull Request are welcome if you think that you have a fix. I never used the prefix so I'm not the best person to look into this

@someusersomeuser
Copy link
Contributor Author

simple way is check that translationPrefix already contains

but imho true way remove prefix from all *Menu sources, and save it in translateMenuItemsFromTitleKey.

what is your opinion?

@ghiscoding
Copy link
Owner

hmm I`m not sure that adding string check of the prefix for every single translation key is necessary a good thing. I would rather fix the source of the duplicate prefix. The thing is that as I said I never used it myself and the person who opened this issue in Aurelia-Slickgrid, which I've added the feature for him, never came back to me to confirm if it works as expected. So I'm not necessarily surprised about this new issue you opened, So I still think fixing the source is ideal

@someusersomeuser
Copy link
Contributor Author

someusersomeuser commented Aug 10, 2022

I checked the code history. I think previously it worked as expected.
this commit adds duplicate prefix feat(plugins): move external Header Menu into Slickgrid-Universal

my new idea - simply remove prefix from translateMenuItemsFromTitleKey

then internal keys still contains prefix, if it is set
and for custom menu items, user can add another namespace if needed, or use default namespace, or set the same prefix manually

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

No branches or pull requests

2 participants