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