Locale module uses an array to store data of translatable projects and available translations during its translation update batch processes. Further different (helper) function are used to process the project related data. Readability and maintainability of the code could be improved by combining functions and data storage in a TranslatableProject class and by using a typed class to store the translation file data. Suggested by Berdir in #1804688: Download and import interface translations #14. This gives the opportunity to simplify the way the $source data is handled within the batch operations as suggested in #14 of the same issue.

Files: 
CommentFileSizeAuthor
#15 locale-project-translation-object-1842380-15.patch44.51 KBocsilalala
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,606 pass(es), 107 fail(s), and 80 exception(s).
[ View ]

Comments

Assigned:Unassigned» Sutharsan
Issue tags:+sprint

Tagging for extra attention ;)

Issue tags:+language-ui

Should this not be based on Update module representing projects with a class instance first and foremost?

Status:Active» Postponed
Issue tags:-sprint

I think this should be postponed on introducing project classes themselves, no? That is #1832946: Create a small project API to be used by Update and Locale.

Agree

Status:Postponed» Needs review
StatusFileSize
new44.15 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch locale-project-translation-object-1842380-5.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Sharing my ideas of how to improve the readability and maintainability of the code by aggregating the project translation state and helper functions into one class. The patch is build on top of #1998056: Automatically update interface translations using cron #25 and therefore quires that patch to be applied first.

Status:Needs review» Needs work

The last submitted patch, locale-project-translation-object-1842380-5.patch, failed testing.

Issue tags:+Needs reroll

Issue summary:View changes

Updated issue summary.

Assigned:Sutharsan» akshay.swnt22
Issue summary:View changes

The patch file which i was applying is not there.
File path:
/core/modules/locale/lib/Drupal/locale/ProjectTranslationState.php
also checked on git.

The patch file is for core/modules/locale/lib/Drupal/locale/ProjectTranslationState.php
which does not exist in core module.

The patch needs to be rerolled first. See https://drupal.org/patch/reroll‎ for instructions.

StatusFileSize
new44.49 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 65,067 pass(es), 110 fail(s), and 84 exception(s).
[ View ]

Re-roll.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 12: locale-project-translation-object-1842380-12.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new44.51 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,606 pass(es), 107 fail(s), and 80 exception(s).
[ View ]

re-roll

Status:Needs review» Needs work

The last submitted patch, 15: locale-project-translation-object-1842380-15.patch, failed testing.

Unassigning @akshay.swnt2. If you are still woking of the issue, please tell us here.

After discussing with Sutharsan I'm proposing the next solution:

- we wait until #1842362: Replace locale_project table and improve caching will be committed
- we rewrite the interface for the project storage to return TranslatableProject instances
- we rewrite the interface for project storage to save TranslatableProjects inside the key value store. We can create a toArray() method on the translatable projects class.
- we'll store the translation status for each project inside the TranslatableProject data, this means it will be saved with the other project data in the key value store into the locale.project collection.

I propose also the following class names:
- project storage: LocaleProjectStorage
- translatable project class: LocaleTranslatableProject or just TranslatableProject