diff --git a/include/class.forms.php b/include/class.forms.php index 77248c8287705b7b5abb6b9ba8cf40a8f9d13e24..dafc403f1ec85d14663607e2ab3b5d44d1b598db 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -781,7 +781,8 @@ class TextareaField extends FormField { 'placeholder' => new TextboxField(array( 'id'=>5, 'label'=>__('Placeholder'), 'required'=>false, 'default'=>'', 'hint'=>__('Text shown in before any input from the user'), - 'configuration'=>array('size'=>40, 'length'=>40), + 'configuration'=>array('size'=>40, 'length'=>40, + 'translatable'=>$this->getTranslateTag('placeholder')), )), ); } diff --git a/include/staff/dynamic-form.inc.php b/include/staff/dynamic-form.inc.php index 2e429debbe199b87459516ecc21b0d4695b515b6..b79a4320d6f190d529cd0e258ad937e3b362581c 100644 --- a/include/staff/dynamic-form.inc.php +++ b/include/staff/dynamic-form.inc.php @@ -50,7 +50,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </tr> <tr> <td width="180"><?php echo __('Instructions'); ?>:</td> - <td><textarea name="instructions" rows="3" cols="40"><?php + <td><textarea name="instructions" rows="3" cols="40" + data-translate-tag="<?php echo $trans['instructions']; ?>"><?php echo $info['instructions']; ?></textarea> <i class="help-tip icon-question-sign" href="#form_instructions"></i> </td> diff --git a/include/staff/settings-system.inc.php b/include/staff/settings-system.inc.php index 748041692575e2111d3cd38ee4ad462edd5be777..3a87722b58b442d37b45a1a2f4a1d8dbddec9fbb 100644 --- a/include/staff/settings-system.inc.php +++ b/include/staff/settings-system.inc.php @@ -208,7 +208,7 @@ $gmtime = Misc::gmtime(); </td><td style="border:none;"> <a href="#<?php echo $lang; ?>" onclick="javascript: - if (confirm(__('You sure?'))) { + if (confirm('<?php echo __('You sure?'); ?>'))) { $(this).closest('form').find('input[name=\'secondary_langs[]\'][value=' + $(this).attr('href').substr(1) + ']').val(''); $(this).closest('tr').remove(); diff --git a/include/staff/templates/dynamic-field-config.tmpl.php b/include/staff/templates/dynamic-field-config.tmpl.php index 8051e31ef4fa2ee4834d5447d3d448d44441bded..d9db95352e1c1de6fcaf655d2f3bfb94e0b6d458 100644 --- a/include/staff/templates/dynamic-field-config.tmpl.php +++ b/include/staff/templates/dynamic-field-config.tmpl.php @@ -44,8 +44,9 @@ <em style="color:gray;display:inline-block"> <?php echo __('Help text shown with the field'); ?></em> </div> - <div> - <textarea style="width:100%" name="hint" rows="2" cols="40"><?php + <div style="width:100%"> + <textarea style="width:90%; width:calc(100% - 20px)" name="hint" rows="2" cols="40" + data-translate-tag="<?php echo $field->getTranslateTag('hint'); ?>"><?php echo Format::htmlchars($field->get('hint')); ?></textarea> </div> </div> @@ -63,5 +64,5 @@ <div class="clear"></div> <script type="text/javascript"> // Make translatable fields translatable - $('input[data-translate-tag]').translatable(); + $('input[data-translate-tag], textarea[data-translate-tag]').translatable(); </script> diff --git a/scp/js/jquery.translatable.js b/scp/js/jquery.translatable.js index 8726abca66e0807fdfe7f7d92622279ba6f55003..7e06f3fdf4f223b0c9054a565252aba7b0d8cf66 100644 --- a/scp/js/jquery.translatable.js +++ b/scp/js/jquery.translatable.js @@ -9,11 +9,13 @@ if (!this.$element.data('translateTag')) return; - var self = this; - this.fetch('ajax.php/i18n/langs').then(function(json) { - self.langs = json; - if (Object.keys(self.langs).length) self.decorate(); - }); + this.shown = false; + this.populated = false; + + this.fetch('ajax.php/i18n/langs').then($.proxy(function(json) { + this.langs = json; + if (Object.keys(this.langs).length) this.decorate(); + }, this)); }, // Class-static variables urlcache = {}; @@ -42,12 +44,14 @@ this.$container = $('<div class="translatable"></div>') .prependTo(this.$element.parent()) .append(this.$element); + this.$container.wrap('<div style="display:inline-block;position:relative;width:inherit"></div>'); this.$button = $(this.options.button).insertAfter(this.$container); - //this.$menu.append('<a class="close pull-right" href=""><i class="icon-remove-circle"></i></a>') - // .on('click', $.proxy(this.hide, this)); + this.$menu.append($('<span class="close"><i class="icon-remove"></i></span>') + .on('click', $.proxy(this.hide, this))); + if (this.$element.is('textarea')) { + this.$container.addClass('textarea'); + } this.$menu.append(this.$translations).append(this.$footer); - this.shown = false; - this.populated = false; this.$button.on('click', $.proxy(this.toggle, this)); diff --git a/scp/js/scp.js b/scp/js/scp.js index a9a67b04fe0c0c8b04ef462ee2a34233e2de6787..1650871eccbc0f3bbaf0d702658f1e10bed5c4ac 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -445,7 +445,7 @@ var scp_prep = function() { }); // Make translatable fields translatable - $('input[data-translate-tag]').translatable(); + $('input[data-translate-tag], textarea[data-translate-tag]').translatable(); }; $(document).ready(scp_prep);