]> git.0d.be Git - panikdb.git/blob - panikdb/static/ckeditor/ckeditor/samples/uilanguages.html
start new regie home page
[panikdb.git] / panikdb / static / ckeditor / ckeditor / samples / uilanguages.html
1 <!DOCTYPE html>\r
2 <!--\r
3 Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
4 For licensing, see LICENSE.md or http://ckeditor.com/license\r
5 -->\r
6 <html>\r
7 <head>\r
8         <title>User Interface Globalization &mdash; CKEditor Sample</title>\r
9         <meta charset="utf-8">\r
10         <script src="../ckeditor.js"></script>\r
11         <script src="assets/uilanguages/languages.js"></script>\r
12         <link rel="stylesheet" href="sample.css">\r
13 </head>\r
14 <body>\r
15         <h1 class="samples">\r
16                 <a href="index.html">CKEditor Samples</a> &raquo; User Interface Languages\r
17         </h1>\r
18         <div class="description">\r
19                 <p>\r
20                         This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements\r
21                         with a CKEditor instance with an option to change the language of its user interface.\r
22                 </p>\r
23                 <p>\r
24                         It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates\r
25                         a drop-down list that lets the user change the UI language.\r
26                 </p>\r
27                 <p>\r
28                         By default, CKEditor automatically localizes the editor to the language of the user.\r
29                         The UI language can be controlled with two configuration options:\r
30                         <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-language">language</a></code> and\r
31                         <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-defaultLanguage">\r
32                         defaultLanguage</a></code>. The <code>defaultLanguage</code> setting specifies the\r
33                         default CKEditor language to be used when a localization suitable for user's settings is not available.\r
34                 </p>\r
35                 <p>\r
36                         To specify the user interface language that will be used no matter what language is\r
37                         specified in user's browser or operating system, set the <code>language</code> property:\r
38                 </p>\r
39 <pre class="samples">\r
40 CKEDITOR.replace( '<em>textarea_id</em>', {\r
41         // Load the German interface.\r
42         <strong>language: 'de'</strong>\r
43 });</pre>\r
44                 <p>\r
45                         Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of\r
46                         the <code>&lt;textarea&gt;</code> element to be replaced.\r
47                 </p>\r
48         </div>\r
49         <form action="sample_posteddata.php" method="post">\r
50                 <p>\r
51                         Available languages (<span id="count"> </span> languages!):<br>\r
52                         <script>\r
53 \r
54                                 document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );\r
55 \r
56                                 // Get the language list from the _languages.js file.\r
57                                 for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ ) {\r
58                                         document.write(\r
59                                                 '<option value="' + window.CKEDITOR_LANGS[i].code + '">' +\r
60                                                         window.CKEDITOR_LANGS[i].name +\r
61                                                 '</option>' );\r
62                                 }\r
63 \r
64                                 document.write( '</select>' );\r
65 \r
66                         </script>\r
67                         <br>\r
68                         <span style="color: #888888">\r
69                                 (You may see strange characters if your system does not support the selected language)\r
70                         </span>\r
71                 </p>\r
72                 <p>\r
73                         <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>\r
74                         <script>\r
75 \r
76                                 // Set the number of languages.\r
77                                 document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;\r
78 \r
79                                 var editor;\r
80 \r
81                                 function createEditor( languageCode ) {\r
82                                         if ( editor )\r
83                                                 editor.destroy();\r
84 \r
85                                         // Replace the <textarea id="editor"> with an CKEditor\r
86                                         // instance, using default configurations.\r
87                                         editor = CKEDITOR.replace( 'editor1', {\r
88                                                 language: languageCode,\r
89 \r
90                                                 on: {\r
91                                                         instanceReady: function() {\r
92                                                                 // Wait for the editor to be ready to set\r
93                                                                 // the language combo.\r
94                                                                 var languages = document.getElementById( 'languages' );\r
95                                                                 languages.value = this.langCode;\r
96                                                                 languages.disabled = false;\r
97                                                         }\r
98                                                 }\r
99                                         });\r
100                                 }\r
101 \r
102                                 // At page startup, load the default language:\r
103                                 createEditor( '' );\r
104 \r
105                         </script>\r
106                 </p>\r
107         </form>\r
108         <div id="footer">\r
109                 <hr>\r
110                 <p>\r
111                         CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
112                 </p>\r
113                 <p id="copy">\r
114                         Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
115                         Knabben. All rights reserved.\r
116                 </p>\r
117         </div>\r
118 </body>\r
119 </html>\r