Version Notes
- Fixed namespace bug, a namespace is always added now.
- Fixed an issue where deleting a storeview resulted in a 404 on the detail of untranslated strings.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Phpro_Translate |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1.1
- app/code/community/Phpro/Translate/Block/Adminhtml/Edit/Form.php +13 -2
- app/code/community/Phpro/Translate/Block/Adminhtml/Grid.php +1 -0
- app/code/community/Phpro/Translate/Block/Adminhtml/Renderer/String.php +13 -0
- app/code/community/Phpro/Translate/Helper/Data.php +17 -0
- app/code/community/Phpro/Translate/Model/System/Config/Source/Store/Locales.php +3 -1
- app/code/community/Phpro/Translate/Model/Translator.php +8 -8
- app/code/community/Phpro/Translate/controllers/TranslationsController.php +43 -15
- app/code/community/Phpro/Translate/etc/config.xml +1 -1
- app/code/community/Phpro/Translate/etc/system.xml +17 -17
- app/code/community/Phpro/Translate/sql/translate_setup/mysql4-install-0.1.0.php +1 -1
- app/code/community/Phpro/Translate/sql/translate_setup/mysql4-upgrade-1.1.0-1.1.1.php +14 -0
- package.xml +6 -5
app/code/community/Phpro/Translate/Block/Adminhtml/Edit/Form.php
CHANGED
@@ -70,7 +70,12 @@ class Phpro_Translate_Block_Adminhtml_Edit_Form extends Mage_Adminhtml_Block_Wid
|
|
70 |
'class' => '',
|
71 |
'name' => 'original_translation'
|
72 |
));
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
74 |
$form->setValues($formValues);
|
75 |
|
76 |
$form->setUseContainer(true);
|
@@ -101,17 +106,23 @@ class Phpro_Translate_Block_Adminhtml_Edit_Form extends Mage_Adminhtml_Block_Wid
|
|
101 |
|
102 |
private function _getFormValuesFromRegistry() {
|
103 |
$values = Mage::registry('translate_data')->getData();
|
|
|
|
|
|
|
104 |
$values['original_translation'] = $values['string'];
|
105 |
$values['original_translation_label'] = $values['string'];
|
|
|
106 |
return $values;
|
107 |
}
|
108 |
|
109 |
private function _getFormValuesFromRequest($request, $store) {
|
110 |
$values = array();
|
111 |
$values['module'] = $request->getParam('modules');
|
112 |
-
$
|
|
|
113 |
$values['original_translation'] = base64_decode($request->getParam('original'));
|
114 |
$splitOfOriginalTranslation = explode("::", $values['original_translation']);
|
|
|
115 |
$values['original_translation_label'] = (isset($splitOfOriginalTranslation[1]) ? $splitOfOriginalTranslation[1] : $splitOfOriginalTranslation[0]);
|
116 |
$values['interface'] = $request->getParam('interface');
|
117 |
$values['locale'] = $request->getParam('locale');
|
70 |
'class' => '',
|
71 |
'name' => 'original_translation'
|
72 |
));
|
73 |
+
|
74 |
+
$fieldset->addField('namespace', 'hidden', array(
|
75 |
+
'class' => '',
|
76 |
+
'name' => 'namespace'
|
77 |
+
));
|
78 |
+
|
79 |
$form->setValues($formValues);
|
80 |
|
81 |
$form->setUseContainer(true);
|
106 |
|
107 |
private function _getFormValuesFromRegistry() {
|
108 |
$values = Mage::registry('translate_data')->getData();
|
109 |
+
$explode = explode('::', $values['string']);
|
110 |
+
$values['string'] = (isset($explode[1])) ? $explode[1] : $values['string'];
|
111 |
+
|
112 |
$values['original_translation'] = $values['string'];
|
113 |
$values['original_translation_label'] = $values['string'];
|
114 |
+
$values['namespace'] = Mage::registry('translate_data')->getModule();
|
115 |
return $values;
|
116 |
}
|
117 |
|
118 |
private function _getFormValuesFromRequest($request, $store) {
|
119 |
$values = array();
|
120 |
$values['module'] = $request->getParam('modules');
|
121 |
+
$translation = explode('::', base64_decode($request->getParam('translation')));
|
122 |
+
$values['string'] = (isset($translation[1])) ? $translation[1] : base64_decode($request->getParam('translation'));
|
123 |
$values['original_translation'] = base64_decode($request->getParam('original'));
|
124 |
$splitOfOriginalTranslation = explode("::", $values['original_translation']);
|
125 |
+
$values['namespace'] = (isset($splitOfOriginalTranslation[1]) ? $splitOfOriginalTranslation[0] : '');
|
126 |
$values['original_translation_label'] = (isset($splitOfOriginalTranslation[1]) ? $splitOfOriginalTranslation[1] : $splitOfOriginalTranslation[0]);
|
127 |
$values['interface'] = $request->getParam('interface');
|
128 |
$values['locale'] = $request->getParam('locale');
|
app/code/community/Phpro/Translate/Block/Adminhtml/Grid.php
CHANGED
@@ -44,6 +44,7 @@ class Phpro_Translate_Block_Adminhtml_Grid extends Mage_Adminhtml_Block_Widget_G
|
|
44 |
'type' => 'text',
|
45 |
'truncate' => 50,
|
46 |
'escape' => true,
|
|
|
47 |
));
|
48 |
|
49 |
$localesSourceModel = Mage::getModel('translate/system_config_source_locales');
|
44 |
'type' => 'text',
|
45 |
'truncate' => 50,
|
46 |
'escape' => true,
|
47 |
+
'renderer' => 'Phpro_Translate_Block_Adminhtml_Renderer_String'
|
48 |
));
|
49 |
|
50 |
$localesSourceModel = Mage::getModel('translate/system_config_source_locales');
|
app/code/community/Phpro/Translate/Block/Adminhtml/Renderer/String.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Phpro_Translate_Block_Adminhtml_Renderer_String extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
|
4 |
+
|
5 |
+
public function render(Varien_Object $row) {
|
6 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
7 |
+
$explode = explode('::', $value);
|
8 |
+
$string = (isset($explode[1])) ? $explode[1] : $value;
|
9 |
+
|
10 |
+
return $string;
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
app/code/community/Phpro/Translate/Helper/Data.php
CHANGED
@@ -29,5 +29,22 @@ class Phpro_Translate_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
29 |
public function getVersion() {
|
30 |
return $version = Mage::getConfig()->getModuleConfig("Phpro_Translate")->version;
|
31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
}
|
29 |
public function getVersion() {
|
30 |
return $version = Mage::getConfig()->getModuleConfig("Phpro_Translate")->version;
|
31 |
}
|
32 |
+
|
33 |
+
public function allowedToLogString($locale, $interface) {
|
34 |
+
$allowed = false;
|
35 |
+
|
36 |
+
if ($this->getAdvancedLoggingStatus()) {
|
37 |
+
if (in_array($interface, $this->getTranslationInterfaces())) {
|
38 |
+
if ($this->isGroupLogging()) {
|
39 |
+
$locales = explode(',', $this->getLocales());
|
40 |
+
if (in_array($locale, $locales) && $locale != 'en_US') {
|
41 |
+
$allowed = true;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
return $allowed;
|
48 |
+
}
|
49 |
|
50 |
}
|
app/code/community/Phpro/Translate/Model/System/Config/Source/Store/Locales.php
CHANGED
@@ -5,7 +5,9 @@ class Phpro_Translate_Model_System_Config_Source_Store_Locales {
|
|
5 |
public function toArray() {
|
6 |
$locales = array();
|
7 |
foreach (Mage::app()->getStores() as $key => $store) {
|
8 |
-
|
|
|
|
|
9 |
}
|
10 |
return $locales;
|
11 |
}
|
5 |
public function toArray() {
|
6 |
$locales = array();
|
7 |
foreach (Mage::app()->getStores() as $key => $store) {
|
8 |
+
if ($store->getConfig('general/locale/code') != 'en_US') { // We don't allow logging en_US, it's translated already.
|
9 |
+
array_push($locales, $store->getConfig('general/locale/code'));
|
10 |
+
}
|
11 |
}
|
12 |
return $locales;
|
13 |
}
|
app/code/community/Phpro/Translate/Model/Translator.php
CHANGED
@@ -61,8 +61,9 @@ class Phpro_Translate_Model_Translator extends Mage_Core_Model_Translate {
|
|
61 |
// TODO: remove duplicates
|
62 |
$dbResults = $this->_matchStringInDb($string, $locale);
|
63 |
foreach ($dbResults as $dbResult) {
|
64 |
-
|
65 |
-
$
|
|
|
66 |
}
|
67 |
|
68 |
if (count($results) >= 2000) {
|
@@ -230,11 +231,9 @@ class Phpro_Translate_Model_Translator extends Mage_Core_Model_Translate {
|
|
230 |
protected function _loadAdvancedModuleTranslation($forceReload=false) {
|
231 |
// Locale doorsturen naar alle 'load translation' methoden, zodanig dat deze daar rekening mee houden en niet de back-end locale nemen!!!
|
232 |
$config = $this->_getModuleConfig();
|
233 |
-
//Mage::log(print_r($config,true));
|
234 |
foreach ($config as $moduleName => $info) {
|
235 |
if ($moduleName == $this->getSearchModules() || $this->getSearchModules() == "all") {
|
236 |
$info = $info->asArray();
|
237 |
-
//Mage::log($info['files']);
|
238 |
foreach ($info['files'] as $file) {
|
239 |
$file = $this->_getAdvancedModuleFilePath($moduleName, $file);
|
240 |
$this->_addDataToTranslate($this->_getFileData($file), $moduleName, $forceReload, 'Module');
|
@@ -327,12 +326,12 @@ class Phpro_Translate_Model_Translator extends Mage_Core_Model_Translate {
|
|
327 |
} elseif (array_key_exists($text, $this->getData())) {
|
328 |
$translated = $this->_data[$text];
|
329 |
} else {
|
330 |
-
if ($this->_helper()->
|
331 |
$this->_saveUnTranslatedString($text, $code);
|
332 |
}
|
333 |
$translated = $text;
|
334 |
}
|
335 |
-
|
336 |
return $translated;
|
337 |
}
|
338 |
|
@@ -345,7 +344,7 @@ class Phpro_Translate_Model_Translator extends Mage_Core_Model_Translate {
|
|
345 |
*/
|
346 |
protected function _addData($data, $scope, $forceReload=false) {
|
347 |
foreach ($data as $key => $value) {
|
348 |
-
if ($key === $value && !Mage::getStoreConfig('translate/general/
|
349 |
continue;
|
350 |
}
|
351 |
$key = $this->_prepareDataString($key);
|
@@ -381,7 +380,7 @@ class Phpro_Translate_Model_Translator extends Mage_Core_Model_Translate {
|
|
381 |
$module = $moduleString[0];
|
382 |
|
383 |
$data = array(
|
384 |
-
"string" => $text,
|
385 |
"module" => $module,
|
386 |
"store_id" => Mage::app()->getStore()->getId(),
|
387 |
"locale" => Mage::app()->getLocale()->getDefaultLocale(),
|
@@ -393,6 +392,7 @@ class Phpro_Translate_Model_Translator extends Mage_Core_Model_Translate {
|
|
393 |
Mage::getModel('translate/translate')->setData($data)->save();
|
394 |
} catch (Exception $e) {
|
395 |
//Do nothing, probably just DB constraint failing.
|
|
|
396 |
}
|
397 |
}
|
398 |
|
61 |
// TODO: remove duplicates
|
62 |
$dbResults = $this->_matchStringInDb($string, $locale);
|
63 |
foreach ($dbResults as $dbResult) {
|
64 |
+
$explode = explode('::', $dbResult->getString());
|
65 |
+
$translate = (isset($explode[1])) ? $explode[1] : $dbResult->getString();
|
66 |
+
$results[$dbResult->getString()][$dbResult->getLocale()] = array('translate' => $translate, 'db_id' => $dbResult->getTranslateId(), 'source' => 'Untranslated String (' . $dbResult->getModule() . ')');
|
67 |
}
|
68 |
|
69 |
if (count($results) >= 2000) {
|
231 |
protected function _loadAdvancedModuleTranslation($forceReload=false) {
|
232 |
// Locale doorsturen naar alle 'load translation' methoden, zodanig dat deze daar rekening mee houden en niet de back-end locale nemen!!!
|
233 |
$config = $this->_getModuleConfig();
|
|
|
234 |
foreach ($config as $moduleName => $info) {
|
235 |
if ($moduleName == $this->getSearchModules() || $this->getSearchModules() == "all") {
|
236 |
$info = $info->asArray();
|
|
|
237 |
foreach ($info['files'] as $file) {
|
238 |
$file = $this->_getAdvancedModuleFilePath($moduleName, $file);
|
239 |
$this->_addDataToTranslate($this->_getFileData($file), $moduleName, $forceReload, 'Module');
|
326 |
} elseif (array_key_exists($text, $this->getData())) {
|
327 |
$translated = $this->_data[$text];
|
328 |
} else {
|
329 |
+
if ($this->_helper()->allowedToLogString(Mage::app()->getLocale()->getDefaultLocale(), $this->getConfig(self::CONFIG_KEY_AREA))) {
|
330 |
$this->_saveUnTranslatedString($text, $code);
|
331 |
}
|
332 |
$translated = $text;
|
333 |
}
|
334 |
+
|
335 |
return $translated;
|
336 |
}
|
337 |
|
344 |
*/
|
345 |
protected function _addData($data, $scope, $forceReload=false) {
|
346 |
foreach ($data as $key => $value) {
|
347 |
+
if ($key === $value && !Mage::getStoreConfig('translate/general/translation_logging')) {
|
348 |
continue;
|
349 |
}
|
350 |
$key = $this->_prepareDataString($key);
|
380 |
$module = $moduleString[0];
|
381 |
|
382 |
$data = array(
|
383 |
+
"string" => $module . '::' . $text,
|
384 |
"module" => $module,
|
385 |
"store_id" => Mage::app()->getStore()->getId(),
|
386 |
"locale" => Mage::app()->getLocale()->getDefaultLocale(),
|
392 |
Mage::getModel('translate/translate')->setData($data)->save();
|
393 |
} catch (Exception $e) {
|
394 |
//Do nothing, probably just DB constraint failing.
|
395 |
+
//Mage::log('Translate module: ' . $e->getMessage(), Zend_Log::ERR);
|
396 |
}
|
397 |
}
|
398 |
|
app/code/community/Phpro/Translate/controllers/TranslationsController.php
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_Action
|
|
|
4 |
|
5 |
-
public function indexAction()
|
|
|
6 |
$logging_enabled = Mage::getStoreConfig('translate/general/translation_logging');
|
7 |
$logging_interfaces = Mage::getStoreConfig('translate/general/translation_interfaces');
|
8 |
$logging_locales = Mage::getStoreConfig('translate/general/locales');
|
@@ -25,7 +27,8 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
25 |
$this->renderLayout();
|
26 |
}
|
27 |
|
28 |
-
public function editAction()
|
|
|
29 |
$id = $this->getRequest()->getParam('id');
|
30 |
$model = Mage::getModel('translate/translate')->load($id);
|
31 |
|
@@ -60,17 +63,31 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
public function saveAction()
|
|
|
64 |
//write data away to core_translate table
|
65 |
$resource = Mage::getResourceModel('core/translate_string');
|
66 |
|
67 |
$request = $this->getRequest();
|
68 |
$translate_id = $request->getParam('id');
|
69 |
$original = $request->getParam('original_translation');
|
|
|
|
|
70 |
$custom = $request->getParam('string');
|
71 |
$locale = $request->getParam('locale');
|
72 |
$storeId = $request->getParam('storeid');
|
73 |
$storeViewSpecific = $request->getParam('storeview_specific');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
if ($storeId != 0 && $storeViewSpecific != 1) {
|
76 |
$storeId = 0;
|
@@ -111,7 +128,8 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
111 |
/**
|
112 |
* AJAX request for untranslated grid
|
113 |
*/
|
114 |
-
public function gridAction()
|
|
|
115 |
$this->getResponse()
|
116 |
->setBody(
|
117 |
$this->getLayout()
|
@@ -123,7 +141,8 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
123 |
/**
|
124 |
* AJAX request for string search
|
125 |
*/
|
126 |
-
public function searchAction()
|
|
|
127 |
$cache = $this->getRequest()->getParam('cache');
|
128 |
if (!$cache) {
|
129 |
$string = $this->getRequest()->getParam('q');
|
@@ -164,9 +183,11 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
164 |
$this->getResponse()->setBody($response);
|
165 |
}
|
166 |
|
167 |
-
public function truncateAction()
|
|
|
168 |
$collection = Mage::getModel('translate/translate')->getCollection();
|
169 |
-
foreach ($collection as $item)
|
|
|
170 |
$item->delete();
|
171 |
}
|
172 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('translate')->__('Table truncated'));
|
@@ -174,7 +195,8 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
174 |
$this->_redirect('*/*/');
|
175 |
}
|
176 |
|
177 |
-
public function removeDuplicateAction()
|
|
|
178 |
$collection = Mage::getModel('translate/translate')->getCollection();
|
179 |
|
180 |
$results = Mage::getModel('core/translate')->removeDuplicatesInTable();
|
@@ -183,7 +205,8 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
183 |
$this->_redirect('*/*/');
|
184 |
}
|
185 |
|
186 |
-
public function sortAction()
|
|
|
187 |
$cache = Mage::getModel('core/cache');
|
188 |
$column = $this->getRequest()->getParam('column');
|
189 |
$order = $cache->load('translate_search_order');
|
@@ -193,7 +216,8 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
193 |
case 'origin':
|
194 |
$keys = array_keys($results);
|
195 |
$locale = array();
|
196 |
-
foreach ($keys as $key => $value)
|
|
|
197 |
$locale[$key] = substr($value, 0, strpos($value, ':'));
|
198 |
$keys[$key] = substr($value, (strpos($value, ':') + 1));
|
199 |
}
|
@@ -211,7 +235,8 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
211 |
break;
|
212 |
}
|
213 |
|
214 |
-
foreach ($keys as $key => $value)
|
|
|
215 |
$sortedKey = $locale[$key] . ':' . $value;
|
216 |
$temp[$sortedKey] = $results[$sortedKey];
|
217 |
}
|
@@ -219,7 +244,9 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
219 |
|
220 |
break;
|
221 |
case 'source':
|
222 |
-
|
|
|
|
|
223 |
if (strcmp($x['source'], $y['source']) == 0) {
|
224 |
return 0;
|
225 |
} else if (strcmp($x['source'], $y['source']) < 0) {
|
@@ -257,11 +284,12 @@ class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_A
|
|
257 |
break;
|
258 |
}
|
259 |
|
260 |
-
foreach ($keys as $key)
|
|
|
261 |
$temp[$key] = $results[$key];
|
262 |
}
|
263 |
$results = $temp;
|
264 |
-
|
265 |
break;
|
266 |
case 'translate':
|
267 |
default:
|
1 |
<?php
|
2 |
|
3 |
+
class Phpro_Translate_TranslationsController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
|
6 |
+
public function indexAction()
|
7 |
+
{
|
8 |
$logging_enabled = Mage::getStoreConfig('translate/general/translation_logging');
|
9 |
$logging_interfaces = Mage::getStoreConfig('translate/general/translation_interfaces');
|
10 |
$logging_locales = Mage::getStoreConfig('translate/general/locales');
|
27 |
$this->renderLayout();
|
28 |
}
|
29 |
|
30 |
+
public function editAction()
|
31 |
+
{
|
32 |
$id = $this->getRequest()->getParam('id');
|
33 |
$model = Mage::getModel('translate/translate')->load($id);
|
34 |
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
public function saveAction()
|
67 |
+
{
|
68 |
//write data away to core_translate table
|
69 |
$resource = Mage::getResourceModel('core/translate_string');
|
70 |
|
71 |
$request = $this->getRequest();
|
72 |
$translate_id = $request->getParam('id');
|
73 |
$original = $request->getParam('original_translation');
|
74 |
+
$namespace = $request->getParam('namespace');
|
75 |
+
$module = $request->getParam('module');
|
76 |
$custom = $request->getParam('string');
|
77 |
$locale = $request->getParam('locale');
|
78 |
$storeId = $request->getParam('storeid');
|
79 |
$storeViewSpecific = $request->getParam('storeview_specific');
|
80 |
+
|
81 |
+
Mage::log($original);
|
82 |
+
|
83 |
+
if ($namespace != '') {
|
84 |
+
$explode = explode('::', $original);
|
85 |
+
if (count($explode) > 1) {
|
86 |
+
$original = $explode[0] . '::' . $explode[1];
|
87 |
+
} else {
|
88 |
+
$original = $namespace . '::' . $original;
|
89 |
+
}
|
90 |
+
}
|
91 |
|
92 |
if ($storeId != 0 && $storeViewSpecific != 1) {
|
93 |
$storeId = 0;
|
128 |
/**
|
129 |
* AJAX request for untranslated grid
|
130 |
*/
|
131 |
+
public function gridAction()
|
132 |
+
{
|
133 |
$this->getResponse()
|
134 |
->setBody(
|
135 |
$this->getLayout()
|
141 |
/**
|
142 |
* AJAX request for string search
|
143 |
*/
|
144 |
+
public function searchAction()
|
145 |
+
{
|
146 |
$cache = $this->getRequest()->getParam('cache');
|
147 |
if (!$cache) {
|
148 |
$string = $this->getRequest()->getParam('q');
|
183 |
$this->getResponse()->setBody($response);
|
184 |
}
|
185 |
|
186 |
+
public function truncateAction()
|
187 |
+
{
|
188 |
$collection = Mage::getModel('translate/translate')->getCollection();
|
189 |
+
foreach ($collection as $item)
|
190 |
+
{
|
191 |
$item->delete();
|
192 |
}
|
193 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('translate')->__('Table truncated'));
|
195 |
$this->_redirect('*/*/');
|
196 |
}
|
197 |
|
198 |
+
public function removeDuplicateAction()
|
199 |
+
{
|
200 |
$collection = Mage::getModel('translate/translate')->getCollection();
|
201 |
|
202 |
$results = Mage::getModel('core/translate')->removeDuplicatesInTable();
|
205 |
$this->_redirect('*/*/');
|
206 |
}
|
207 |
|
208 |
+
public function sortAction()
|
209 |
+
{
|
210 |
$cache = Mage::getModel('core/cache');
|
211 |
$column = $this->getRequest()->getParam('column');
|
212 |
$order = $cache->load('translate_search_order');
|
216 |
case 'origin':
|
217 |
$keys = array_keys($results);
|
218 |
$locale = array();
|
219 |
+
foreach ($keys as $key => $value)
|
220 |
+
{ // strip locale code away
|
221 |
$locale[$key] = substr($value, 0, strpos($value, ':'));
|
222 |
$keys[$key] = substr($value, (strpos($value, ':') + 1));
|
223 |
}
|
235 |
break;
|
236 |
}
|
237 |
|
238 |
+
foreach ($keys as $key => $value)
|
239 |
+
{
|
240 |
$sortedKey = $locale[$key] . ':' . $value;
|
241 |
$temp[$sortedKey] = $results[$sortedKey];
|
242 |
}
|
244 |
|
245 |
break;
|
246 |
case 'source':
|
247 |
+
|
248 |
+
function compare($x, $y)
|
249 |
+
{
|
250 |
if (strcmp($x['source'], $y['source']) == 0) {
|
251 |
return 0;
|
252 |
} else if (strcmp($x['source'], $y['source']) < 0) {
|
284 |
break;
|
285 |
}
|
286 |
|
287 |
+
foreach ($keys as $key)
|
288 |
+
{
|
289 |
$temp[$key] = $results[$key];
|
290 |
}
|
291 |
$results = $temp;
|
292 |
+
|
293 |
break;
|
294 |
case 'translate':
|
295 |
default:
|
app/code/community/Phpro/Translate/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Phpro_Translate>
|
5 |
-
<version>1.
|
6 |
</Phpro_Translate>
|
7 |
</modules>
|
8 |
<phpunit>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Phpro_Translate>
|
5 |
+
<version>1.1.1</version>
|
6 |
</Phpro_Translate>
|
7 |
</modules>
|
8 |
<phpunit>
|
app/code/community/Phpro/Translate/etc/system.xml
CHANGED
@@ -13,25 +13,25 @@
|
|
13 |
<frontend_type>text</frontend_type>
|
14 |
<sort_order>301</sort_order>
|
15 |
<show_in_default>1</show_in_default>
|
16 |
-
<show_in_website>
|
17 |
-
<show_in_store>
|
18 |
<groups>
|
19 |
<general translate="label">
|
20 |
<label>Translate options</label>
|
21 |
<frontend_type>text</frontend_type>
|
22 |
<sort_order>1</sort_order>
|
23 |
-
|
24 |
-
<show_in_website>
|
25 |
-
<show_in_store>
|
26 |
<fields>
|
27 |
<translation_logging translate="label">
|
28 |
<label>Enable Translation Logging</label>
|
29 |
<frontend_type>select</frontend_type>
|
30 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
<sort_order>1</sort_order>
|
32 |
-
|
33 |
-
<show_in_website>
|
34 |
-
<show_in_store>
|
35 |
<comment>Log all untranslated strings in a database table.</comment>
|
36 |
</translation_logging>
|
37 |
<translation_interfaces translate="label">
|
@@ -40,9 +40,9 @@
|
|
40 |
<source_model>translate/system_config_source_interface
|
41 |
</source_model>
|
42 |
<sort_order>1</sort_order>
|
43 |
-
|
44 |
-
<show_in_website>
|
45 |
-
<show_in_store>
|
46 |
<comment>Select for which interfaces you want to enable logging.</comment>
|
47 |
</translation_interfaces>
|
48 |
<locales translate="label">
|
@@ -51,9 +51,9 @@
|
|
51 |
<source_model>translate/system_config_source_store_locales
|
52 |
</source_model>
|
53 |
<sort_order>2</sort_order>
|
54 |
-
|
55 |
-
<show_in_website>
|
56 |
-
<show_in_store>
|
57 |
<comment>Which locales should be logged?</comment>
|
58 |
</locales>
|
59 |
<customer_groups translate="label">
|
@@ -62,9 +62,9 @@
|
|
62 |
<source_model>translate/system_config_source_groups
|
63 |
</source_model>
|
64 |
<sort_order>3</sort_order>
|
65 |
-
|
66 |
-
<show_in_website>
|
67 |
-
<show_in_store>
|
68 |
<comment>Select for which customer groups you want to enable logging.</comment>
|
69 |
</customer_groups>
|
70 |
</fields>
|
13 |
<frontend_type>text</frontend_type>
|
14 |
<sort_order>301</sort_order>
|
15 |
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>0</show_in_website>
|
17 |
+
<show_in_store>0</show_in_store>
|
18 |
<groups>
|
19 |
<general translate="label">
|
20 |
<label>Translate options</label>
|
21 |
<frontend_type>text</frontend_type>
|
22 |
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>0</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
<fields>
|
27 |
<translation_logging translate="label">
|
28 |
<label>Enable Translation Logging</label>
|
29 |
<frontend_type>select</frontend_type>
|
30 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>0</show_in_website>
|
34 |
+
<show_in_store>0</show_in_store>
|
35 |
<comment>Log all untranslated strings in a database table.</comment>
|
36 |
</translation_logging>
|
37 |
<translation_interfaces translate="label">
|
40 |
<source_model>translate/system_config_source_interface
|
41 |
</source_model>
|
42 |
<sort_order>1</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>0</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
<comment>Select for which interfaces you want to enable logging.</comment>
|
47 |
</translation_interfaces>
|
48 |
<locales translate="label">
|
51 |
<source_model>translate/system_config_source_store_locales
|
52 |
</source_model>
|
53 |
<sort_order>2</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>0</show_in_website>
|
56 |
+
<show_in_store>0</show_in_store>
|
57 |
<comment>Which locales should be logged?</comment>
|
58 |
</locales>
|
59 |
<customer_groups translate="label">
|
62 |
<source_model>translate/system_config_source_groups
|
63 |
</source_model>
|
64 |
<sort_order>3</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>0</show_in_website>
|
67 |
+
<show_in_store>0</show_in_store>
|
68 |
<comment>Select for which customer groups you want to enable logging.</comment>
|
69 |
</customer_groups>
|
70 |
</fields>
|
app/code/community/Phpro/Translate/sql/translate_setup/mysql4-install-0.1.0.php
CHANGED
@@ -8,7 +8,7 @@ $installer->run("
|
|
8 |
`translate_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
9 |
`string` varchar(255) NOT NULL DEFAULT '',
|
10 |
`module` varchar(255) NOT NULL,
|
11 |
-
`store_id` smallint(
|
12 |
`locale` varchar(20) NOT NULL DEFAULT '',
|
13 |
`interface` varchar(20) NOT NULL,
|
14 |
PRIMARY KEY (`translate_id`),
|
8 |
`translate_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
9 |
`string` varchar(255) NOT NULL DEFAULT '',
|
10 |
`module` varchar(255) NOT NULL,
|
11 |
+
`store_id` smallint(5) unsigned NOT NULL DEFAULT '0',
|
12 |
`locale` varchar(20) NOT NULL DEFAULT '',
|
13 |
`interface` varchar(20) NOT NULL,
|
14 |
PRIMARY KEY (`translate_id`),
|
app/code/community/Phpro/Translate/sql/translate_setup/mysql4-upgrade-1.1.0-1.1.1.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$installer->run("
|
7 |
+
CREATE INDEX idx_store ON {$this->getTable('phpro_translate')} (store_id);
|
8 |
+
ALTER TABLE {$this->getTable('phpro_translate')}
|
9 |
+
CHANGE `store_id` `store_id` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '0';
|
10 |
+
ALTER TABLE {$this->getTable('phpro_translate')}
|
11 |
+
ADD CONSTRAINT fk_storeview_untranslated FOREIGN KEY (store_id) REFERENCES {$this->getTable('core_store')} (store_id) ON DELETE CASCADE ON UPDATE CASCADE;
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Phpro_Translate</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,12 @@
|
|
9 |
<summary>A tool to locate untranslated strings in your store</summary>
|
10 |
<description>This tool keeps an eye out for untranslated strings and reports them to the user.
|
11 |
You can edit untranslated string or existing translation</description>
|
12 |
-
<notes
|
|
|
13 |
<authors><author><name>PHPro</name><user>auto-converted</user><email>info@phpro.be</email></author></authors>
|
14 |
-
<date>2012-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magecommunity"><dir name="Phpro"><dir name="Translate"><dir name="Block"><dir name="Adminhtml"><dir name="Edit"><file name="Form.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies/>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Phpro_Translate</name>
|
4 |
+
<version>1.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>A tool to locate untranslated strings in your store</summary>
|
10 |
<description>This tool keeps an eye out for untranslated strings and reports them to the user.
|
11 |
You can edit untranslated string or existing translation</description>
|
12 |
+
<notes>- Fixed namespace bug, a namespace is always added now.
|
13 |
+
- Fixed an issue where deleting a storeview resulted in a 404 on the detail of untranslated strings.</notes>
|
14 |
<authors><author><name>PHPro</name><user>auto-converted</user><email>info@phpro.be</email></author></authors>
|
15 |
+
<date>2012-03-22</date>
|
16 |
+
<time>08:40:23</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Phpro"><dir name="Translate"><dir name="Block"><dir name="Adminhtml"><dir name="Edit"><file name="Form.php" hash="82316209e2389a5f0e5b8e64f6c567a8"/><file name="Tabs.php" hash="ab7c8279caf43f38554f0c23888d637c"/></dir><dir name="Renderer"><file name="String.php" hash="146ce9be5e0819258462f5df1d45da2c"/></dir><file name="About.php" hash="5bdb23632c813038095ecfb3016903ba"/><file name="Edit.php" hash="f24357792a565c941941ab77a03d31b3"/><file name="Form.php" hash="b2f7e5e44048fae6a419acdad76ec59a"/><file name="Grid.php" hash="800962533cf19452134b4f21ba33ca5e"/><file name="Stats.php" hash="02a2464f21630a502c81b14c4d1c62ae"/><file name="Tabs.php" hash="4feb67aff966df21decd7c0c093d7912"/><file name="Translate.php" hash="f78afcd2f8002a672851959760595efd"/><file name="TranslateResult.php" hash="e08ba5cf9d142f2f4404c0deff111e94"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b7adabdd4d656efbe903d509920185d5"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Translate"><file name="Collection.php" hash="724672e61cd9c4de91938f4189c229fe"/></dir><file name="Translate.php" hash="a812ee20cd14226464701f16c9e0bc1b"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Store"><file name="Locales.php" hash="485c16c61f66a18f0684e81da180f7e1"/></dir><file name="Groups.php" hash="7654613534e2b5dd23d8a656af7ea6c1"/><file name="Interface.php" hash="2c7827684b00b655f1818300bd581691"/><file name="Locales.php" hash="b56472fc4c77ef82c14f8daebc12f1b0"/><file name="Modules.php" hash="763418cbf8d8fb377eafde6efd542538"/><file name="Stores.php" hash="dd8a59da45b74e48134f2fd3a6f6658b"/></dir></dir></dir><file name="Translate.php" hash="1cb0c7167c2a0bd42a20c0f972e966a7"/><file name="Translation.php" hash="d256e2c56d01267d33b7005c6ec163b7"/><file name="Translator.php" hash="8fbc758a0a02b7649fd80eb9306d6e08"/></dir><dir name="Test"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><dir name="fixtures"><file name="defaultsetup.yaml" hash="e699d7579b8a496071b2a1a94ee20e45"/></dir></dir><dir name="Grid"><dir name="fixtures"><file name="defaultsetup.yaml" hash="467aefacab1a43e34732d74ea8e79829"/></dir></dir><file name="Form.php" hash="46464733fb219ddecad9129270f44af4"/><file name="Grid.php" hash="9b1dc9baa217d2ccde6cc1ac9efb7c17"/></dir></dir><dir name="Controller"><dir name="IndexController"><dir name="fixtures"><file name="translation_logging_disabled.yaml" hash="cb202eff6b35ec5b58c7596a3cd70434"/><file name="translation_logging_enabled.yaml" hash="86d0fbbe5c1b95cae8eb21c6b460ee75"/></dir></dir><dir name="TranslationsController"><dir name="fixtures"><file name="admin_user.yaml" hash="b24e11045ac495034e61a60b5d9f154b"/><file name="core_config_data.yaml" hash="0009c2ba1904b61778b107ceeefc0929"/><file name="core_translate.yaml" hash="98c3c9b5f1389401782d6d4a189c8bbc"/><file name="phpro_advancedtranslate.yaml" hash="fb9229ae95bea8d859df7e0274703444"/><file name="stores.yaml" hash="11f6ecac0f2a04c19a0538b789c630d9"/></dir></dir><file name="IndexController.php" hash="fbe579e0066bccfce35180cfb211127f"/><file name="TranslationsController.php" hash="4e43fe0445bec36cb9ba6900d4fdf283"/></dir><dir name="Helper"><dir name="Data"><dir name="fixtures"><file name="core_config_data.yaml" hash="c5f01d5ab9b8adfd29a5bbae1bd00640"/></dir></dir><file name="Data.php" hash="f69d3394a213113f57b91910ca20e2d9"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Locales"><dir name="fixtures"><file name="phpro_advancedtranslate.yaml" hash="513469551ef0b51e3608fca2c19049bb"/></dir></dir><dir name="Store"><dir name="Locales"><dir name="fixtures"><file name="core_config_data.yaml" hash="313f20d823ae4e41fb1518796300a729"/><file name="stores.yaml" hash="150e0ea6d518e3885d2046467fae6269"/></dir></dir><file name="Locales.php" hash="39c76892a4a6215f8d962f77aabe356c"/></dir><dir name="Stores"><dir name="fixtures"><file name="core_config_data.yaml" hash="313f20d823ae4e41fb1518796300a729"/><file name="phpro_advancedtranslate.yaml" hash="f49111ff655c87127d246f65b8d167a0"/><file name="stores.yaml" hash="fb78978542ca38c5a33504079afe225f"/></dir></dir><file name="Locales.php" hash="909e96abc09832b89ef12a02f91053f7"/><file name="Stores.php" hash="3f587d212b39b533be60d607a9c35ec0"/></dir></dir></dir><dir name="Translate"><dir name="fixtures"><file name="core_translate.yaml" hash="8df16aa3c10434b936253ec64d817f8b"/><file name="stores.yaml" hash="f37ffbb2c1a29083ba86263a27aaeb62"/></dir></dir><file name="Translator.php" hash="cd3ae824b78815c404142d63b4cbd7c2"/></dir></dir><dir name="controllers"><file name="TranslationsController.php" hash="88db4d61f8c569792876337963f17197"/></dir><dir name="etc"><file name="config.xml" hash="a4513945e66bb163c9a8123c0ace9123"/><file name="system.xml" hash="b6197573ecdd32180ab210d7015a4e59"/></dir><dir name="sql"><dir name="translate_setup"><file name="mysql4-install-0.1.0.php" hash="ed1f0b0012f9e460b537c51b3f2fbe8c"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="a75e2a8efd55bf1d440a599274d1d669"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="f7a3bf7a9579d1ac1b4e9f657421455d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="translate.xml" hash="d6f83b0a0a47c1f5f9b9438052fcb9e4"/></dir><dir name="template"><dir name="translate"><file name="about.phtml" hash="0d13f0ff640d3c53eef96cfa03b4fb00"/><file name="container.phtml" hash="beb35d0c45a9f59d6d21046456046c3c"/><file name="search.phtml" hash="84fd8f11d0c24e3ae0233b8578a9e06f"/><file name="translateresult.phtml" hash="40efb67fef21e6c81b26b8e0131b9a38"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Phpro_Translate.xml" hash="93cf18237a2bd21f27e3046ceacf7f27"/></dir></target><target name="mageweb"><dir name="js"><dir name="phpro"><file name="translate.js" hash="e5a2a8d282e96b36962df049e41649cb"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="phpro"><file name="gridfix.css" hash="ebc173f92bbd2b72b5e7e47f36748e72"/></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|