Changeset 379:fb925235a866
- Timestamp:
- 06/17/11 08:41:21 (14 years ago)
- Branch:
- wysiwyg
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/dcToolBar.js
r326 r379 16 16 $.data(this,'toolbar',new tinymce.Editor($(this).attr('id'),dcToolBar.getConfig(settings.formatter))); 17 17 $(this).data('toolbar').activeFormatter = settings.formatter; 18 $(this).data('toolbar').onPreInit.add(function(ed) { 19 tinymce.addI18n(dcToolBar.getI18n()); 20 }); 18 21 }); 19 22 … … 32 35 throw 'Toolbar should be initialize before show it'; 33 36 } 34 $(this).data('toolbar').show(); 37 var t = $(this).data('toolbar'); 38 39 tinymce.dom.show(t.getContainer()); 40 t.load(); 35 41 }); 36 42 }, … … 40 46 throw 'Toolbar should be initialize before hide it'; 41 47 } 42 $(this).data('toolbar').hide(); 48 var t = $(this).data('toolbar'); 49 50 tinymce.dom.hide(t.getContainer()); 51 t.load(); 43 52 }); 44 53 }, … … 48 57 throw 'Toolbar should be initialize before toogle it'; 49 58 } 50 if ($(this).data('toolbar').isHidden()) { 51 $(this).data('toolbar').show(); 52 } else { 53 $(this).data('toolbar').hide(); 59 var t = $(this).data('toolbar'); 60 if (t.isHidden()) { 61 t.show(); 62 t.load(); 63 } 64 else { 65 t.save(); 66 $(t.getContainer()).hide(); 54 67 } 55 68 }); … … 97 110 }; 98 111 112 this.setI18n = function(i18n) { 113 this.i18n = i18n; 114 }; 115 99 116 this.getConfig = function(formatter) { 100 117 if (this.configurations.hasOwnProperty(formatter)) { … … 104 121 } 105 122 }; 123 124 this.getI18n = function() { 125 return this.i18n == null ? {} : this.i18n; 126 }; 106 127 } 107 128 108 129 dcToolBar.prototype = { 109 configurations: {} 130 configurations: {}, 131 i18n: null 110 132 } -
inc/admin/class.dc.toolbar.php
r329 r379 10 10 $this->core = $core; 11 11 $this->toolbars = array(); 12 $this->i18n = array(); 12 13 } 13 14 … … 67 68 68 69 foreach($buttons as $level => $ids) { 70 if (!is_array($ids)) { 71 continue; 72 } 69 73 $level = !preg_match('#^[1-4]$#',$level) ? 1 : $level; 70 74 $this->toolbars[$formatter]['buttons'][$level] = array_merge($this->toolbars[$formatter]['buttons'][$level],$ids); 71 75 } 76 } 77 78 public function addI18n($component,$i18n) 79 { 80 if (!is_array($i18n)) { 81 return; 82 } 83 if (!array_key_exists($component,$this->i18n)) { 84 $this->i18n[$component] = array(); 85 } 86 87 $this->i18n[$component] = array_merge($this->i18n[$component],$i18n); 72 88 } 73 89 … … 95 111 } 96 112 113 // Add translation 114 $i18n = array(); 115 116 foreach ($this->i18n as $component => $values) { 117 array_walk($this->i18n[$component],create_function('&$v,$k','$v=sprintf("\'%s\': \'%s\'",$k,html::escapeJS($v));')); 118 array_push($i18n,sprintf('%s: {%s}',$component,implode(',',$this->i18n[$component]))); 119 } 120 121 $res .= !empty($i18n) ? sprintf("dcToolBar.setI18n({%s: {%s}});\n",'en',implode(",\n",$i18n)) : ''; 122 97 123 return $res; 98 124 } -
inc/admin/lib.dc.page.php
r329 r379 605 605 'removeformat', 606 606 'cleanup', 607 'seperator', 608 'cut', 609 'copy', 610 'paste', 607 'separator', 611 608 'pastetext', 612 609 'pasteword', 610 'separator', 613 611 'search', 614 612 'replace' … … 682 680 'code' 683 681 ) 682 )); 683 684 $tb->addI18n('common',array( 685 'edit_confirm' => __('Do you want to use the WYSIWYG mode for this textarea?'), 686 'apply' => __('Apply'), 687 'insert' => __('Insert'), 688 'update' => __('Update'), 689 'cancel' => __('Cancel'), 690 'close' => __('Close'), 691 'browse' => __('Browse'), 692 'class_name' => __('Class'), 693 'not_set' => __('-- Not set --'), 694 'clipboard_msg' => __('Copy/Cut/Paste is not available in Mozilla and Firefox. Do you want more information about this issue?'), 695 'clipboard_no_support' => __('Currently not supported by your browser, use keyboard shortcuts instead.'), 696 'popup_blocked' => __('Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'), 697 'invalid_data' => __('{#field} is invalid'), 698 'invalid_data_number' => __('{#field} must be a number'), 699 'invalid_data_min' => __('{#field} must be a number greater than {#min}'), 700 'invalid_data_size' => __('{#field} must be a number or percentage'), 701 'more_colors' => __('More colors') 702 )); 703 $tb->addI18n('advanced',array( 704 'style_select' => __('Styles'), 705 'font_size' => __('Font size'), 706 'fontdefault' => __('Font family'), 707 'block' => __('Format'), 708 'paragraph' => __('Paragraph'), 709 'div' => __('Div'), 710 'address' => __('Address'), 711 'pre' => __('Preformatted'), 712 'h1' => __('Heading 1'), 713 'h2' => __('Heading 2'), 714 'h3' => __('Heading 3'), 715 'h4' => __('Heading 4'), 716 'h5' => __('Heading 5'), 717 'h6' => __('Heading 6'), 718 'blockquote' => __('Blockquote'), 719 'code' => __('Code'), 720 'samp' => __('Code sample'), 721 'dt' => __('Definition term '), 722 'dd' => __('Definition description'), 723 'bold_desc' => __('Bold (Ctrl+prout)'), 724 'italic_desc' => __('Italic (Ctrl+I)'), 725 'underline_desc' => __('Underline (Ctrl+U)'), 726 'striketrough_desc' => __('Strikethrough'), 727 'justifyleft_desc' => __('Align left'), 728 'justifycenter_desc' => __('Align center'), 729 'justifyright_desc' => __('Align right'), 730 'justifyfull_desc' => __('Align full'), 731 'bullist_desc' => __('Unordered list'), 732 'numlist_desc' => __('Ordered list'), 733 'outdent_desc' => __('Outdent'), 734 'indent_desc' => __('Indent'), 735 'undo_desc' => __('Undo (Ctrl+Z)'), 736 'redo_desc' => __('Redo (Ctrl+Y)'), 737 'link_desc' => __('Insert/edit link'), 738 'unlink_desc' => __('Unlink'), 739 'image_desc' => __('Insert/edit image'), 740 'cleanup_desc' => __('Cleanup messy code'), 741 'code_desc' => __('Edit HTML Source'), 742 'sub_desc' => __('Subscript'), 743 'sup_desc' => __('Superscript'), 744 'hr_desc' => __('Insert horizontal ruler'), 745 'removeformat_desc' => __('Remove formatting'), 746 'custom1_desc' => __('Your custom description here'), 747 'forecolor_desc' => __('Select text color'), 748 'backcolor_desc' => __('Select background color'), 749 'charmap_desc' => __('Insert custom character'), 750 'visualaid_desc' => __('Toggle guidelines/invisible elements'), 751 'anchor_desc' => __('Insert/edit anchor'), 752 'cut_desc' => __('Cut'), 753 'copy_desc' => __('Copy'), 754 'paste_desc' => __('Paste'), 755 'image_props_desc' => __('Image properties'), 756 'newdocument_desc' => __('New document'), 757 'help_desc' => __('Help'), 758 'blockquote_desc' => __('Blockquote'), 759 'clipboard_msg' => __('Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?'), 760 'path' => __('Path'), 761 'newdocument' => __('Are you sure you want clear all contents?'), 762 'toolbar_focus' => __('Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'), 763 'more_colors' => __('More colors'), 764 'shortcuts_desc' => __('Accessibility Help'), 765 'help_shortcut' => __('. Press ALT F10 for toolbar. Press ALT 0 for help.'), 766 'rich_text_area' => __('Rich Text Area'), 767 'toolbar' => __('Toolbar') 768 )); 769 $tb->addI18n('advanced_dlg',array( 770 'about_title' => __('About TinyMCE'), 771 'about_general' => __('About'), 772 'about_help' => __('Help'), 773 'about_license' => __('License'), 774 'about_plugins' => __('Plugins'), 775 'about_plugin' => __('Plugin'), 776 'about_author' => __('Author'), 777 'about_version' => __('Version'), 778 'about_loaded' => __('Loaded plugins'), 779 'anchor_title' => __('Insert/edit anchor'), 780 'anchor_name' => __('Anchor name'), 781 'anchor_invalid' => __('Please specify a valid anchor name.'), 782 'code_title' => __('HTML Source Editor'), 783 'code_wordwrap' => __('Word wrap'), 784 'charmap_title' => __('Select custom character'), 785 'accessibility_help' => __('Accessibility Help'), 786 'accessibility_usage_title' => __('General Usage') 787 )); 788 $tb->addI18n('paste',array( 789 'paste_text_desc' => __('Paste as Plain Text'), 790 'paste_word_desc' => __('Paste from Word'), 791 'selectall_desc' => __('Select All'), 792 'plaintext_mode_sticky' => __('Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.'), 793 'plaintext_mode' => __('Paste is now in plain text mode. Click again to toggle back to regular paste mode.') 794 )); 795 $tb->addI18n('paste_dlg',array( 796 'text_title' => __('Use CTRL+V on your keyboard to paste the text into the window.'), 797 'text_linebreaks' => __('Keep linebreaks'), 798 'word_title' => __('Use CTRL+V on your keyboard to paste the text into the window.') 799 )); 800 $tb->addI18n('fullscreen',array('desc' => __('Toggle fullscreen mode'))); 801 $tb->addI18n('aria',array('rich_text_area' => __('Rich Text Area'))); 802 803 $tb->addI18n('dcControls',array( 804 'inlinecode_desc' => __('Code'), 805 'quote_desc' => __('Quote'), 806 'link_desc' => __('Link'), 807 'media_desc' => __('Add media from media manager'), 808 'webmedia_desc' => __('Add media from web') 684 809 )); 685 810
Note: See TracChangeset
for help on using the changeset viewer.