-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix broken translations in module list page #14613
Fix broken translations in module list page #14613
Conversation
- link module actions to related translation domain - set those relations as module attribute - fix module action display name generation - use correct translation domain
@@ -23,7 +23,7 @@ | |||
* International Registered Trademark & Property of PrestaShop SA | |||
*#} | |||
|
|||
{% set displayAction = action|capitalize|replace({'_': " "})|trans({}, 'Admin.Actions') %} | |||
{% set displayAction = action|title|replace({'_': " "})|trans({}, transDomain[action]) %} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the capitalize filter would only capitalize the first character, here we need a ucwords kind of filter. Happily the title filter does just that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the trans
filter be called before using the title
one? Or else the key might not be recognized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question @jolelievre, initially the capitalize filter was used to build the translation key. But it failed, because capitalize makes a ucfirst, when what was needed to build a proper translation key was a ucwords (in this case anyway). The title filter does the needed ucwords
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! then you need top check if the keys are present in the catalogue. Because the catalog is built by scanning the PrestaShop code and fetching all the hard coded strings. It is not able to compute variables. So unless these keys are used explicitly somewhere else in the code they won't be present in the catalogue and won't be translated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they exist in the catalog, from what I've seen and understood, those values are used as constants in the code (php side), and made to be transformed into translation keys easily (twig side).
@LouiseBonnard |
@@ -701,6 +701,11 @@ | |||
{% endblock birthday_widget %} | |||
|
|||
{% block file_widget %} | |||
<style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two spaces for indent please
482e67c
to
0e13986
Compare
Hello @breizoreol, thanks a lot for the PR! What translation do you need? Actually, the word Browse (localized in Admin.Actions) is okay, we just have to make it translatable - this way, it will be part of the 1.7.7 catalog on Crowdin and the community will be able to translate it in all different languages. Feel free to ask me more information if needed, perhaps my issue was not that clear. ;-) |
src/PrestaShopBundle/Resources/views/Admin/TwigTemplateForm/bootstrap_4_layout.html.twig
Outdated
Show resolved
Hide resolved
@@ -701,6 +701,11 @@ | |||
{% endblock birthday_widget %} | |||
|
|||
{% block file_widget %} | |||
<style> | |||
.custom-file-label:after { | |||
content: "{{ "browse"|trans({}, 'Admin.Actions') }}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write it Browse instead, with a capital letter at the beginning, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done !
0e13986
to
bc029f4
Compare
One question @breizoreol, how about the Disable mobile entry, would it be fixed in another PR or in this one? |
@LouiseBonnard yes, the 'Disable mobile' was not translated due to a mistake in the code, that is fixed in this pr. |
Thank you @matthieu-rolland 🎉 |
…translation Broken translation in module list page:
This change is