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

Broken translation in module list page: #14613

Merged
merged 2 commits into from Jul 17, 2019

Conversation

@matthieu-rolland
Copy link
Contributor

commented Jul 12, 2019

  • link module actions names to related translation domain
  • fix module action display name generation
  • use correct translation domain
Questions Answers
Branch? develop
Description? Translation broken in module listing page, in the action dropdown of each item.
Type? bug fix
Category? BO
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #14589
How to test? See description in the issue

This change is Reviewable

fix broken translation in module list page:
- link module actions to related translation domain
- set those relations as module attribute
- fix module action display name generation
- use correct translation domain

@matthieu-rolland matthieu-rolland requested a review from PrestaShop/prestashop-core-developers as a code owner Jul 12, 2019

@@ -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]) %}

This comment has been minimized.

Copy link
@matthieu-rolland

matthieu-rolland Jul 12, 2019

Author Contributor

the capitalize filter would only capitalize the first character, here we need a ucwords kind of filter. Happily the title filter does just that.

This comment has been minimized.

Copy link
@jolelievre

jolelievre Jul 16, 2019

Contributor

Shouldn't the trans filter be called before using the title one? Or else the key might not be recognized?

This comment has been minimized.

Copy link
@matthieu-rolland

matthieu-rolland Jul 17, 2019

Author Contributor

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

This comment has been minimized.

Copy link
@jolelievre

jolelievre Jul 17, 2019

Contributor

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.

This comment has been minimized.

Copy link
@matthieu-rolland

matthieu-rolland Jul 18, 2019

Author Contributor

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).

@matthieu-rolland

This comment has been minimized.

Copy link
Contributor Author

commented Jul 12, 2019

@LouiseBonnard
We need a translation for the word "browse" for when a button opens the file explorer.
(that would be "parcourir" in french)

@@ -701,6 +701,11 @@
{% endblock birthday_widget %}

{% block file_widget %}
<style>

This comment has been minimized.

Copy link
@PierreRambaud

PierreRambaud Jul 12, 2019

Contributor

two spaces for indent please

@matthieu-rolland matthieu-rolland force-pushed the matthieu-rolland:fix-broken-translation branch from 482e67c to 0e13986 Jul 12, 2019

@LouiseBonnard

This comment has been minimized.

Copy link
Contributor

commented Jul 15, 2019

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. ;-)

@@ -701,6 +701,11 @@
{% endblock birthday_widget %}

{% block file_widget %}
<style>
.custom-file-label:after {
content: "{{ "browse"|trans({}, 'Admin.Actions') }}";

This comment has been minimized.

Copy link
@LouiseBonnard

LouiseBonnard Jul 15, 2019

Contributor

Please write it Browse instead, with a capital letter at the beginning, thank you.

This comment has been minimized.

Copy link
@matthieu-rolland

matthieu-rolland Jul 16, 2019

Author Contributor

done !

@matthieu-rolland matthieu-rolland force-pushed the matthieu-rolland:fix-broken-translation branch from 0e13986 to bc029f4 Jul 16, 2019

@LouiseBonnard

This comment has been minimized.

Copy link
Contributor

commented Jul 16, 2019

One question @breizoreol, how about the Disable mobile entry, would it be fixed in another PR or in this one?

@PierreRambaud PierreRambaud changed the title fix broken translation in module list page: Broken translation in module list page: Jul 17, 2019

@PierreRambaud PierreRambaud added waiting for QA and removed WIP labels Jul 17, 2019

@matthieu-rolland

This comment has been minimized.

Copy link
Contributor Author

commented Jul 17, 2019

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.

@sarahdib sarahdib added QA ✔️ and removed waiting for QA labels Jul 17, 2019

@sarahdib sarahdib added this to the 1.7.7.0 milestone Jul 17, 2019

@matks

This comment has been minimized.

Copy link
Contributor

commented Jul 17, 2019

Thank you @matthieu-rolland 🎉

@matks matks merged commit 8598baa into PrestaShop:develop Jul 17, 2019

2 checks passed

PrettyCI Code formatting
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

mbadrani added a commit to mbadrani/PrestaShop that referenced this pull request Jul 18, 2019

Merge pull request PrestaShop#14613 from matthieu-rolland/fix-broken-…
…translation

Broken translation in module list page:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.