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

Rename Ecommerce & Goals Category Titles #7885

Merged

Conversation

spacenate
Copy link
Contributor

There were a few changes necessary to implement #6948:

  1. Plugins\Goals\Controller and Plugins\Ecommerce\Controller needed a helper to handle the logic for the different strings needed for "Goals by %s" vs "Goals %s".
  2. Plugins\Goals\Goals and Goals\TranslationHelper needed to know what category a report had, to drive this logic, which means…
  3. Plugin\Report needed a getter for the translation key of a category.

Knowing the category of a report also allows Plugins\Goals\Goals to re-categorize the "CustomVariables" report.

I'm not sure about my approach to I18n in TranslationHelper—will this pattern work for all locales? Is there anything that should be done to transition from the old translation keys? And lastly, are the new translation keys I have created okay? 🎱

@diosmosis diosmosis added the Needs Review PRs that need a code review label May 19, 2015
@diosmosis diosmosis added this to the 2.14.0 milestone May 19, 2015
public function getCategoryKey()
{
return $this->category;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add this method and not use getCategory() like it is now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 3 lines above, getCategory currently translates the category. We will hopefully change that with Piwik 3.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: There is a method that can give you the translation key for a translated string. Maybe it would be easier to use that function instead of adding this one. I currently don't have the project open but can look the method name up if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you are correct! Translate::findTranslationKeyForTranslation()

@spacenate
Copy link
Contributor Author

@mnapoli Thanks for your feedback!

The reason for Report::getCategoryKey() is so TranslationHelper (https://github.com/piwik/piwik/pull/7885/files#diff-1af9522b6752c654ec8d4bbe084a0b2eR37) and Goals (https://github.com/piwik/piwik/pull/7885/files#diff-2cad92c203e05d0e9094913db5c7b92dR33) can base logic off of the category. Report::getCategory() returns an already-translated/localized string, which seems to make this difficult (unless I am overlooking a method that can "un-translate" a string and give you the key?)

I agree with your other feedback :)

I am leaving on vacation tomorrow morning though, so I will not have a chance to amend my PR until until 5/30 👎

@tsteur
Copy link
Member

tsteur commented Jun 9, 2015

Thx for that, nice PR!

tsteur added a commit that referenced this pull request Jun 9, 2015
…ries

Rename Ecommerce & Goals Category Titles
@tsteur tsteur merged commit ed071ab into matomo-org:master Jun 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants