Skip to content

Commit fc7a90a

Browse files
maxmimaxmi
authored andcommitted
JS validation localisation
1 parent c521426 commit fc7a90a

File tree

6 files changed

+65
-14
lines changed

6 files changed

+65
-14
lines changed

src/app/code/community/Zendesk/Zendesk/etc/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
<zendesk>
116116
<file>zendesk.xml</file>
117117
</zendesk>
118+
<jstranslate>
119+
<file>jstranslate.xml</file>
120+
</jstranslate>
118121
</updates>
119122
</layout>
120123
<translate>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright 2015 Zendesk
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
-->
19+
<jstranslator>
20+
<validate-zendesk-sso-token translate="message" module="zendesk">
21+
<message>Token cannot be empty</message>
22+
</validate-zendesk-sso-token>
23+
<validate-zendesk-sso-frontend-token translate="message" module="zendesk">
24+
<message>Token cannot be empty</message>
25+
</validate-zendesk-sso-frontend-token>
26+
</jstranslator>

src/app/design/adminhtml/default/default/layout/zendesk.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
<script>zendesk/validation.js</script>
2727
</action>
2828
</reference>
29+
<reference name="content">
30+
<block type="core/template" name="test" template="zendesk/translations.phtml"></block>
31+
</reference>
2932
</adminhtml_system_config_edit>
3033

3134
<adminhtml_sales_order_view>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Copyright 2015 Zendesk
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
?>
18+
<script>
19+
Translator.add('Token cannot be empty', '<?php echo $this->__('Token cannot be empty'); ?>');
20+
</script>

src/app/locale/en_US/Zendesk_Zendesk.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@
109109
"Decide which features you would like turned on in your admin panel.","Decide which features you would like turned on in your admin panel."
110110
"Show "All" tab on dashboard","Show "All" tab on dashboard"
111111
"Generate New Token","Generate New Token"
112+
"Token cannot be empty","Token cannot be empty"

src/js/zendesk/validation.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
Validation.addAllThese([
22
['validate-zendesk-sso-token', 'Token cannot be empty', function (v) {
3-
if ($('zendesk_sso_enabled').getValue() === '1') {
4-
return !Validation.get('IsEmpty').test(v);
5-
} else {
6-
return true;
7-
}
8-
9-
}],
3+
if ($('zendesk_sso_enabled').getValue() === '1') {
4+
return !Validation.get('IsEmpty').test(v);
5+
} else {
6+
return true;
7+
}
8+
}],
109
['validate-zendesk-sso-frontend-token', 'Token cannot be empty', function (v) {
11-
if ($('zendesk_sso_frontend_enabled').getValue() === '1') {
12-
return !Validation.get('IsEmpty').test(v);
13-
} else {
14-
return true;
15-
}
16-
17-
}]
10+
if ($('zendesk_sso_frontend_enabled').getValue() === '1') {
11+
return !Validation.get('IsEmpty').test(v);
12+
} else {
13+
return true;
14+
}
15+
}]
1816
]);

0 commit comments

Comments
 (0)