Opened 4 years ago

Closed 4 years ago

#1351 closed New feature (fixed)

Check and translate errors/exceptions displayed on screen or returned in API calls

Reported by: halfdan Owned by:
Priority: low Milestone: Piwik 0.6.3
Component: Core Keywords: translation
Cc: Sensitive: no

Description

I saw that core/Access.php has lots of strings that are not getting translated. This should be fixed.

Attachments (25)

core.API.Proxy.patch (2.6 KB) - added by JulienM 4 years ago.
core.API.Request.patch (2.4 KB) - added by JulienM 4 years ago.
core.Archive.Single.patch (2.4 KB) - added by JulienM 4 years ago.
core.ArchiveProcessing.Period.patch (2.2 KB) - added by JulienM 4 years ago.
core.DataTable.Rendered.Rss.patch (2.4 KB) - added by JulienM 4 years ago.
core.DataTable.Renderer.Xml.patch (2.4 KB) - added by JulienM 4 years ago.
core.DataTable.Filter.patch (2.5 KB) - added by JulienM 4 years ago.
core.DataTable.Manager.patch (2.7 KB) - added by JulienM 4 years ago.
core.DataTable.Renderer.2.patch (3.4 KB) - added by JulienM 4 years ago.
core.DataTable.Renderer.patch (3.4 KB) - added by JulienM 4 years ago.
core.DataTable.Row.patch (3.8 KB) - added by JulienM 4 years ago.
core.Period.Day.patch (3.3 KB) - added by JulienM 4 years ago.
core.Period.patch (4.0 KB) - added by JulienM 4 years ago.
core.Period.Range.patch (4.0 KB) - added by JulienM 4 years ago.
core.Tracker.Db.Pdo.Mysql.patch (4.5 KB) - added by JulienM 4 years ago.
core.Tracker.Db.Mysqli.patch (5.3 KB) - added by JulienM 4 years ago.
core.Tracker.Generator.patch (4.1 KB) - added by JulienM 4 years ago.
core.Tracker.GoalManager.patch (4.5 KB) - added by JulienM 4 years ago.
core.Tracker.Visit.patch (5.6 KB) - added by JulienM 4 years ago.
core.Updates.0.4.4.patch (4.6 KB) - added by JulienM 4 years ago.
core.Updates.0.5.4.patch (5.8 KB) - added by JulienM 4 years ago.
core.Updates.0.6-rc1.patch (5.4 KB) - added by JulienM 4 years ago.
translated-exceptions.html (55.2 KB) - added by JulienM 4 years ago.
1351.patch (20.5 KB) - added by JulienM 4 years ago.
translated-exceptions.xls (103.5 KB) - added by JulienM 4 years ago.

Download all attachments as: .zip

Change History (36)

comment:1 Changed 4 years ago by vipsoft (robocoder)

  • Milestone set to 0 - Piwik 0.6.2
  • Priority changed from normal to low

Yes, lots of exception string messages to translate...

comment:2 Changed 4 years ago by matt (mattab)

  • Summary changed from Translate core/Access.php to Check and translate errors/exceptions displayed on screen or returned in API calls

Yeah let's rename this ticket to include all Exception or error messages (displayed to the user screen) yet to be translated.

comment:3 Changed 4 years ago by matt (mattab)

  • Type changed from Bug to New feature

comment:4 Changed 4 years ago by JulienM (JulienMoumne)

I propose to do it file by file. Here is core/API/Proxy.php

comment:5 Changed 4 years ago by JulienM (JulienMoumne)

Please advise on message key string for exception /core/Archive/Array/IndexedBySite.php#111 :

throw new Exception("Piwik_Archive_Array_IndexedBySite::getDataTableFromNumeric() algorithm won't work if data is stored in different tables");


comment:6 Changed 4 years ago by JulienM (JulienMoumne)

do not consider file core.DataTable.Renderer.2.patch

comment:7 follow-up: Changed 4 years ago by JulienM (JulienMoumne)

Please advise on message key string for exceptions :

/core/SmartyPlugins/function.loadJavascriptTranslations.php#37 :

throw new Exception("The smarty function loadJavascriptTranslations needs a 'plugins' parameter.");

/core/SmartyPlugins/function.postEvent.php#34 :

throw new Exception("The smarty function postEvent needs a 'name' parameter.");

/core/SmartyPlugins/modifier.money.php#22 :

throw new Exception('the smarty modifier money expects one parameter: the idSite.');

comment:8 Changed 4 years ago by matt (mattab)

Julien, thanks for the patches - can you please submit one patch that contains all changes?

Otherwise, there are many exception messages that don't need to be translated, as they are never displayed on screen (or when they are, this is not an expected error and it doesn't need to be translated).

Example of exceptions that should never display on user screen (unless a plugin is buggy, or something else went very wrong) and therefore don't need to be translated:

  • 'General_ExceptionInvalidInputDate'
  • 'General_ExceptionSubtableAlreadyAssociated'
  • 'General_ExceptionRSSFeedInvalidDataTable'
  • 'General_ExceptionIDArchiveNull'
  • 'General_ExceptionInvalidAPI'
  • etc.

Also I didn't find General_ExceptionMysqliCharsetFailed in the code?

Basically all exceptions that we translate should not mention 'code specific' issues and should let the user know, in non technical terms, what the error is and why it happened. Let me know if that makes sense

comment:9 in reply to: ↑ 7 Changed 4 years ago by matt (mattab)

Replying to JulienM:

Please advise on message key string for exceptions :

/core/SmartyPlugins/function.loadJavascriptTranslations.php#37 :

throw new Exception("The smarty function loadJavascriptTranslations needs a 'plugins' parameter.");

/core/SmartyPlugins/function.postEvent.php#34 :

throw new Exception("The smarty function postEvent needs a 'name' parameter.");

/core/SmartyPlugins/modifier.money.php#22 :

throw new Exception('the smarty modifier money expects one parameter: the idSite.');

these strings don't need to be translated as they would not appear on screen except during the development of a plugin (and in this case, it's OK to show english to the dev)

comment:10 Changed 4 years ago by JulienM (JulienMoumne)

Patch 1351.patch externalizes exceptions marked in translated-exceptions.html

Changed 4 years ago by JulienM (JulienMoumne)

comment:11 Changed 4 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(In [2246]) Fixes #1351 All error messages displayed to screen/API should not be translated. Thanks JulienM for patch!

I simply refactored the 'you must be have %s access [...]' messages by putting the admin/view/superuser as a parameter in the string

Note: See TracTickets for help on using tickets.