Index: branches/5.2.x/core/units/languages/languages_config.php =================================================================== diff -u -r14585 -r14629 --- branches/5.2.x/core/units/languages/languages_config.php (.../languages_config.php) (revision 14585) +++ branches/5.2.x/core/units/languages/languages_config.php (.../languages_config.php) (revision 14629) @@ -1,6 +1,6 @@ Array ('m/d/Y' => 'mm/dd/yyyy', 'd/m/Y' => 'dd/mm/yyyy', 'm.d.Y' => 'mm.dd.yyyy', 'd.m.Y' => 'dd.mm.yyyy'), 'not_null' => 1, 'required' => 1, 'default' => 'm/d/Y' ), - 'InputTimeFormat' => Array ( - 'type' => 'string', + 'InputTimeFormat' => Array ( + 'type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array ('g:i:s A' => 'g:i:s A', 'g:i A' => 'g:i A', 'H:i:s' => 'H:i:s', 'H:i' => 'H:i'), 'not_null' => '1', 'required' => 1, 'default' => 'g:i:s A', @@ -207,6 +207,11 @@ 'not_null' => 1, 'default' => 'en-US', ), 'UserDocsUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''), + 'SynchronizationModes' => Array ( + 'type' => 'string', 'max_len' => 255, + 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_SynchronizeToOthers', 2 => 'la_opt_SynchronizeFromOthers'), 'use_phrases' => 1, 'multiple' => 1, + 'not_null' => 1, 'default' => '' + ), ), 'VirtualFields' => Array ( @@ -234,7 +239,8 @@ 'AdminInterfaceLang' => Array ('filter_block' => 'grid_options_filter', 'width' => 150, ), 'Charset' => Array ('filter_block' => 'grid_like_filter', 'width' => 100, ), 'Priority' => Array ('filter_block' => 'grid_like_filter', 'width' => 60, ), - 'Enabled' => Array ('filter_block' => 'grid_options_filter', 'width' => 60, ), + 'Enabled' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ), + 'SynchronizationModes' => Array ('filter_block' => 'grid_picker_filter', 'width' => 120, 'format' => ', ', 'hidden' => 1), ), ), Index: branches/5.2.x/core/units/helpers/language_import_helper.php =================================================================== diff -u -r14628 -r14629 --- branches/5.2.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 14628) +++ branches/5.2.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 14629) @@ -1,6 +1,6 @@ $language_node->Attributes['PACKNAME'], 'Encoding' => $language_node->Attributes['ENCODING'], 'Charset' => 'utf-8', + 'SynchronizationModes' => Language::SYNCHRONIZE_DEFAULT, ); if ($version > 1) { Index: branches/5.2.x/core/kernel/constants.php =================================================================== diff -u -r14628 -r14629 --- branches/5.2.x/core/kernel/constants.php (.../constants.php) (revision 14628) +++ branches/5.2.x/core/kernel/constants.php (.../constants.php) (revision 14629) @@ -1,6 +1,6 @@ Application->recallObject('kMultiLanguageHelper'); /* @var $ml_helper kMultiLanguageHelper */ - + $ml_helper->createFields('phrases'); $ml_helper->createFields('emailevents'); @@ -365,6 +365,7 @@ $primary_lang_id = $this->Conn->GetOne($sql); $object->SetDBField('CopyFromLanguage', $primary_lang_id); + $object->SetDBField('SynchronizationModes', Language::SYNCHRONIZE_DEFAULT); } /** @@ -617,31 +618,46 @@ * Copy missing phrases across all system languages (starting from primary) * * @param kEvent $event + * @return void + * @access protected */ - function OnSynchronizeLanguages(&$event) + protected function OnSynchronizeLanguages(&$event) { - if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { + if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) ) { $event->status = kEvent::erFAIL; return; } + $source_languages = $target_languages = Array (); + // get language list with primary language first - $sql = 'SELECT LanguageId + $sql = 'SELECT SynchronizationModes, LanguageId FROM ' . TABLE_PREFIX . 'Language + WHERE SynchronizationModes <> "" ORDER BY PrimaryLang DESC'; + $languages = $this->Conn->GetCol($sql, 'LanguageId'); - $source_langs = $this->Conn->GetCol($sql); - $target_langs = $source_langs; + foreach ($languages as $language_id => $synchronization_modes) { + $synchronization_modes = explode('|', substr($synchronization_modes, 1, -1)); - foreach ($source_langs as $source_id) { - foreach ($target_langs as $target_id) { - if ($source_id == $target_id) { + if ( in_array(Language::SYNCHRONIZE_TO_OTHERS, $synchronization_modes) ) { + $source_languages[] = $language_id; + } + + if ( in_array(Language::SYNCHRONIZE_FROM_OTHERS, $synchronization_modes) ) { + $target_languages[] = $language_id; + } + } + + foreach ($source_languages as $source_id) { + foreach ($target_languages as $target_id) { + if ( $source_id == $target_id ) { continue; } $sql = 'UPDATE ' . TABLE_PREFIX . 'Phrase SET l' . $target_id . '_Translation = l' . $source_id . '_Translation - WHERE (l' . $target_id . '_Translation IS NULL) OR (l' . $target_id . '_Translation = "")'; + WHERE COALESCE(l' . $target_id . '_Translation, "") = "" AND COALESCE(l' . $source_id . '_Translation, "") <> ""'; $this->Conn->Query($sql); } } Index: branches/5.2.x/core/install/upgrades.sql =================================================================== diff -u -r14614 -r14629 --- branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14614) +++ branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14629) @@ -2129,3 +2129,5 @@ ALTER TABLE FormFields ADD UploadExtensions VARCHAR(255) NOT NULL DEFAULT '' AFTER Validation, ADD UploadMaxSize INT NULL AFTER UploadExtensions; + +ALTER TABLE Language ADD SynchronizationModes VARCHAR(255) NOT NULL DEFAULT ''; \ No newline at end of file Index: branches/5.2.x/core/admin_templates/regional/languages_edit.tpl =================================================================== diff -u -r14572 -r14629 --- branches/5.2.x/core/admin_templates/regional/languages_edit.tpl (.../languages_edit.tpl) (revision 14572) +++ branches/5.2.x/core/admin_templates/regional/languages_edit.tpl (.../languages_edit.tpl) (revision 14629) @@ -58,30 +58,30 @@
- - - - + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - + + + - + @@ -105,6 +105,8 @@ + +
Index: branches/5.2.x/core/admin_templates/regional/languages_list.tpl =================================================================== diff -u -r14244 -r14629 --- branches/5.2.x/core/admin_templates/regional/languages_list.tpl (.../languages_list.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/regional/languages_list.tpl (.../languages_list.tpl) (revision 14629) @@ -6,56 +6,92 @@ -
- Index: branches/5.2.x/core/install/english.lang =================================================================== diff -u -r14614 -r14629 --- branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14614) +++ branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14629) @@ -566,6 +566,7 @@ U3VibWlzc2lvbiBOb3RpZmljYXRpb24gRW1haWw= U3VnZ2VzdGVkIENvcnJlY3Rpb24= UG9pbnRzIHRvIFNlY3Rpb24= + U3luY2hyb25pemUgTGFuZ3VhZ2U= VGFibGUgTmFtZSBpbiBEYXRhYmFzZSA= VGFn SXRlbQ== @@ -771,6 +772,8 @@ U3RhdGU= U3ViLW1hdGNo U3VjY2Vzcw== + RnJvbSBvdGhlcnM= + VG8gb3RoZXJz U3lzdGVt VGFi VGVtcGxhdGU=