In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
1023 [In-Portal CMS] Localization feature request N/A 2011-03-13 08:14 2012-10-17 05:53
Added functionality to Keep Language Packs in Sync
0001023: Ability to Keep Language Packs in Sync
1. Tracking Changes

I've imagined that such (or alike) translation system would also be useful for In-Portal websites, who are translated into multiple languages to keep all phrases/e-mails in sync between languages.

a. Add "TranslateFrom" ML column into LanguageLabels (former "Phrases") and EmailEvents (former "Events") database tables
b. Add "Use as Primary" button on phrase/e-mail event edit page (with hint "Use this translation as primary for other languages")
Initially all TranslateFrom columns have 0 in them, that means - "I'm in sync".
c. As you probably noticed user then can press either "Save" or "Use as Primary" button after changing a translation on a specific language he is assigned to translate.

Pressing "Use as Primary" would save phrase/e-mail event translation and set this language ID to TranslateFrom field for all other languages except current one:
l1_TranslateFrom = 3
l2_TranslateFrom = 3
l3_TranslateFrom = 0
l4_TranslateFrom = 3
l5_TranslateFrom = 3
In example above you can easily see, that translation was changed on 3rd language and all other languages needs to be updated to be in sync.

Pressing "Save" would set 0 to TranslateFrom column at current language only, like in example below:
l1_TranslateFrom = 3
l2_TranslateFrom = 3
l3_TranslateFrom = 0
l4_TranslateFrom = 3
l5_TranslateFrom = 0
Here 5th language translation was fixed to be in sync and 0 was set in corresponding field.

Then in phrase/e-mail event list we create column "Translation in Sync" (Yes/No), where we would just compare TranslateFrom column from current language with 0. If it's 0, then all is translated.

On phrase editing page we'll show translation form language indicated in TranslateFrom column and not from primary language. Of course if TranslateFrom = 0, then we can fallback to translation from primary language.

Also I've noticed that we're not showing translation from primary language on e-mail event editing, which makes it harder to translate them.

2. Sync Status in %

Propose another grid column in Regional Configuration menu, called "sync status", where we could display % of
synced labels, for reporting purposes.

SUM(IF(l5_TranslateFrom = 0, 0, 1)) / COUNT(l5_TranslateFrom).

SUM(IF(l5_TranslateFrom = 0, 1, 0)) - phrase count, that doesn't require to be synced
COUNT(l5_TranslateFrom) - total phrase count

In total we'll have following Sync columns:
- "Front-End / Both Labels"
- "Admin Labels"
- "Front-End E-mail Events"
- "Admin E-mail Events"

3. Percentages of Content Block Translation

Create a "Scheduled Task" (former "Agent"), that would count % of translated content blocks for each page, which has them. It of course won't allow to track outdated translations as with phrases, but it at least would tell what content blocks aren't translated at all on other languages.

Add multilingual (one column per language) TranslatedContentBlocks column to Categories database table. For each language execute this SQL to fill it:

SELECT SUM( IF(COALESCE(l1_Content, '') = '', 0, 1) ), PageId
FROM PageContent

ORIGINAL IDEA (replaced with new in May-2012)

Here is some ideas how we can keep language packs from multiple languages synchronized with primary language pack for English language.

We invent such term as translatable unit. Units could consist of one or more fields (textareas) that could be translated. Also translatable unit will feature a Description field, that will tell translator, where exactly given text will be used, so translation could be more accurate and appropriate. Each translatable unit have unique identifier (phrase name for phrases and email event name + email event type for email events). Each translatable unit have version number (integer). Once primary language translation is updated or new translation unit is added, then it's version number is incremented.

When we perform translation of set of the translatable units (language pack) to other language, then each unit will keep it's version, version used to make initial translation). When primary unit translation (on English language) will be changed, then it's version number will changed and will differ from all other translated units in other language packs. This way we can detect translation units, that need to be updated to be in sync.

I suppose, that this will be some script on website. Each website user can register as "translator" for any count of languages so he'll get notified when his expertise is need to keep associated language pack in sync. Page with language packs will be automatically constructed based on finished translation for each language pack and translation progress bar will available for each language pack.

I'll try to look if something, that I've described is already available on the Internet, if not will write something myself.

Here is how Drupal does that:

We can expand this idea to site upgrade so we will track what phrases, email events user have changed and what of there were changed on original language pack in new version of In-Portal and overwrite only not touched by the user.

related to 0001413resolved alex Simultaneous editing message not shown 
patch improved_translation_interface_part1_core.patch (112,884) 2012-10-17 05:48
patch improved_translation_interface_part1_modules.patch (1,626) 2012-10-17 05:48
Issue History
2012-10-17 05:53 alex Note Added: 0005229
2012-10-17 05:50 alex Changeset attached 5.3.x r15584
2012-10-17 05:49 alex Changeset attached 5.3.x r15583
2012-10-17 05:48 alex File Added: improved_translation_interface_part1_modules.patch
2012-10-17 05:48 alex File Added: improved_translation_interface_part1_core.patch
2012-10-17 05:48 alex Note Edited: 0005228 bug_revision_view_page.php?bugnote_id=0005228#r1057
2012-10-17 05:38 alex Note Edited: 0005228 bug_revision_view_page.php?bugnote_id=0005228#r1056
2012-10-17 05:37 alex Note Added: 0005228
2012-10-16 04:28 alex Note Edited: 0005218 bug_revision_view_page.php?bugnote_id=0005218#r1054
2012-10-16 04:28 alex Note Added: 0005227
2012-10-16 04:25 alex Target Version Icebox => 5.3.0
2012-10-15 10:55 alex Relationship added related to 0001413
2012-10-11 10:32 alex Note Edited: 0005218 bug_revision_view_page.php?bugnote_id=0005218#r1053
2012-10-11 10:03 alex Note Edited: 0005218 bug_revision_view_page.php?bugnote_id=0005218#r1052
2012-10-11 08:43 alex Note Added: 0005218
2012-07-17 11:06 Dmitry Estimate Points 0 => 2
2012-06-05 12:42 Dmitry Note Added: 0004709
2012-06-05 12:42 Dmitry Target Version 5.2.0 => Icebox
2012-05-17 02:18 alex Description Updated bug_revision_view_page.php?rev_id=1014#r1014
2012-05-17 02:07 alex Description Updated bug_revision_view_page.php?rev_id=1013#r1013
2012-05-16 23:14 Dmitry Additional Information Updated bug_revision_view_page.php?rev_id=1012#r1012
2012-05-16 23:14 Dmitry Change Log Message => Added functionality to Keep Language Packs in Sync
2012-05-16 23:14 Dmitry Target Version Icebox => 5.2.0
2012-05-16 23:14 Dmitry Summary Keeping language packs from different languages in sync => Ability to Keep Language Packs in Sync
2012-05-16 23:14 Dmitry Description Updated bug_revision_view_page.php?rev_id=1009#r1009
2012-05-16 23:14 Dmitry Additional Information Updated bug_revision_view_page.php?rev_id=1011#r1011
2012-05-15 17:35 Dmitry Estimate Points => 0
2012-05-15 17:35 Dmitry Note Added: 0004628
2012-05-15 17:35 Dmitry Category Software Release => Localization
2012-05-15 17:35 Dmitry Target Version => Icebox
2012-05-15 17:34 Dmitry Project Infrastructure => In-Portal CMS
2011-03-13 08:14 alex New Issue
2011-03-13 08:14 alex Reference =>

2012-05-15 17:35   
Moved task to In-Portal CMS project from Infrastructure.
2012-06-05 12:42   
Moving to Icebox for now.
2012-10-11 08:43   
(edited on: 2012-10-16 04:28)
What can happen and I don't know yet how to overcome this:
1. Website has 3 languages and 1 user per each language who does translation. User1 changed translation on 1st language and made it (translation) primary. How likely User2 and User3 would come into Admin Console at same time and edit same label? Who saves last (due temporary table usage) will overwrite user translation change who saved before him.

2. Same website with English/Russian/Latvian languages. Each of translators only speak 2 languages: language he will translate and English. Russian translator clicked "Use as Primary" button on Russian translation and now all other translators see it instead of primary (English) translation because it's most current. However they can't read Russian to know how to translate it into their language.

3. Toolbar button "Use as Primary" shown on phrase/e-mail event saving page would only work for phrase/e-mail event that user sees right now and won't affect other phrases/e-mail events that user is editing together with this one.

4. Manual language pack import.

5. Deployment script language pack import.

2012-10-16 04:28   
Solutions to above problems

1. show simultaneous edit message to warn 2nd user, who is trying to edit phrase/e-mail event that is already being edited.

2. presume that translator can use "Google Translate" or similar website to translate source language phrase/e-mail event translation into his native language.

3. update all phrases/e-mail events that are being edited right now.

4. add checkbox that would make all imported phrases in sync OR not in sync.

5. make all new phrases/e-mail events unsynced.
2012-10-17 05:37   
(edited on: 2012-10-17 05:48)
What was done besides main task:
1. CSS that was used to highlight code pieces in "System Log" and "E-mail Log" was moved away into Admin Skin
2. Show fields with translation from source language (for given phrase/e-mail event) instead of always translation from primary language
3. Don't show source translation when editing phrase/e-mail event on source language
4. Show "Source Hint Translation" and "Source Column Translation" for phrases
5. Show "Source Subject", "Source HTML Version" and "Source Text Version" for e-mail events
6. Show source translation fields after current translation fields
7. If "Custom" module installed & enabled then use it as default module for newly created e-mail events.
8. Don't show "Set as Primary" toolbar button on phrase/e-mail event editing pages, when there is only 1 language pack imported on website.
9. "%4$s" inside custom fields will be replaced with primary language id (before only "%2$s" was replaced with current language id)
10. LanguageImportHelper now accepts multiple options via bit-system (e.g. 1, 2, 4, 8 ...)

2012-10-17 05:53   
Patches "improved_translation_interface_part1_core.patch" and "improved_translation_interface_part1_modules.patch" contains all translation functionality without translation statistics calculations.