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

missing translation parameter in filter-posts.html #4402

Open
ptandler opened this issue Mar 15, 2022 · 6 comments
Open

missing translation parameter in filter-posts.html #4402

ptandler opened this issue Mar 15, 2022 · 6 comments

Comments

@ptandler
Copy link
Contributor

Describe the bug
The translation for toolbar.searchbar.search_entity requires an entity parameter which is not provided in filter-posts.html for the placeholder.

For German it says " suchen" but the noun what to search for is missing, it should be "Beiträge suchen" (= "search posts").

Where was the bug observed
https://.../views/map

@ptandler
Copy link
Contributor Author

When I replace in filter-posts.html

                <input
                    name="q"
                    type="search"
                    autocomplete="off"
                    placeholder="{{ 'toolbar.searchbar.search_entity' | translate }}"
// ...
                />

with

                <input
                    name="q"
                    type="search"
                    autocomplete="off"
                    placeholder="{{ 'toolbar.searchbar.search_entity' | translate:{ entity: 'posts' } }}"
//...
                />

it says "posts suchen" which is a wee bit better - but "posts" is not translated to German.

@Angamanga
Copy link
Contributor

@ptandler Thank you for adding this issue. I think for this we could just skip the entity and add "Search for posts" instead to get a proper translation into different languages. We always search for posts so that would be ok.

@ptandler
Copy link
Contributor Author

well, right. filter-posts.html sounds like it always filters posts.

@Angamanga Are you sure the translation string isn't used somewhere else in a different context?

And: all translations in all languages need to be adjusted then ...

@ptandler
Copy link
Contributor Author

I just did a full text search: translate="toolbar.searchbar.search_entity" is also used in legacy/app/settings/directives/filter-system/filter-searchbar.html and its only usage I found is in legacy/app/settings/users/filter-users.html which is rendered on https://.../settings/users. However there, the entity is replaced by placeholderText which is never defined, so for the user list, the filter field also shows " search" without the entity to search for.

As the filter-searchbar is a generic component, I regard it to be cleaner to stick to the existing model using the translation with parameters - as long as there is a way to translate the entity when provided as parameter. Is this possible?

@Angamanga
Copy link
Contributor

@ptandler We could scrap "search_entity" entirely and use two new keys instead. It would mean that the strings are un-translated for other languages for a while but eventually they are translated as well. The variables cannot be translated unfortunately.

@ptandler
Copy link
Contributor Author

@Angamanga I haven't looked into it but other i18n systems offer a way to request a translation programmatically, this way one could translate the parameters as expression.

But general, it would make sense to add the new translation strings to have the chance to get them translated before using them in the code. Is there a way to notify translators about new strings?

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

No branches or pull requests

2 participants