source: trunk/admin/inc/ckeditor/_samples/ui_languages.html@ 404

Last change on this file since 404 was 239, checked in by luc, 9 years ago

Admin: correzione visulaizzazione immissione dati spoglio per Chrome e Safari - Aggiornamento dell'editor da FCKeditor a CKeditor , accessibili anche a Chrome e Safari.

  • Property svn:executable set to *
File size: 5.0 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<!--
3Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.html or http://ckeditor.com/license
5-->
6<html xmlns="http://www.w3.org/1999/xhtml">
7<head>
8 <title>User Interface Globalization &mdash; CKEditor Sample</title>
9 <meta content="text/html; charset=utf-8" http-equiv="content-type" />
10 <script type="text/javascript" src="../ckeditor.js"></script>
11 <script type="text/javascript" src="../lang/_languages.js"></script>
12 <script src="sample.js" type="text/javascript"></script>
13 <link href="sample.css" rel="stylesheet" type="text/css" />
14</head>
15<body>
16 <h1 class="samples">
17 CKEditor Sample &mdash; User Interface Languages
18 </h1>
19 <div class="description">
20 <p>
21 This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements
22 with a CKEditor instance with an option to change the language of its user interface.
23 </p>
24 <p>
25 It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates
26 a drop-down list that lets the user change the UI language.
27 </p>
28 <p>
29 By default, CKEditor automatically localizes the editor to the language of the user.
30 The UI language can be controlled with two configuration options:
31 <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.language">
32 <code>language</code></a> and <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.defaultLanguage">
33 <code>defaultLanguage</code></a>. The <code>defaultLanguage</code> setting specifies the
34 default CKEditor language to be used when a localization suitable for user's settings is not available.
35 </p>
36 <p>
37 To specify the user interface language that will be used no matter what language is
38 specified in user's browser or operating system, set the <code>language</code> property:
39 </p>
40 <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
41 {
42 // Load the German interface.
43 <strong>language: 'de'</strong>
44 });</pre>
45 <p>
46 Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
47 the <code>&lt;textarea&gt;</code> element to be replaced.
48 </p>
49 </div>
50 <!-- This <div> holds alert messages to be display in the sample page. -->
51 <div id="alerts">
52 <noscript>
53 <p>
54 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
55 support, like yours, you should still see the contents (HTML data) and you should
56 be able to edit it normally, without a rich editor interface.
57 </p>
58 </noscript>
59 </div>
60 <form action="sample_posteddata.php" method="post">
61 <p>
62 Available languages (<span id="count"> </span> languages!):<br />
63 <script type="text/javascript">
64 //<![CDATA[
65 document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );
66 // Get the language list from the _languages.js file.
67 for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ )
68 {
69 document.write(
70 '<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
71 window.CKEDITOR_LANGS[i].name +
72 '</option>' );
73 }
74 document.write( '</select>' );
75 //]]>
76 </script>
77 <br />
78 <span style="color: #888888">(You may see strange characters if your system does not
79 support the selected language)</span>
80 </p>
81 <p>
82 <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>
83 <script type="text/javascript">
84 //<![CDATA[
85
86 // Set the number of languages.
87 document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
88
89 var editor;
90
91 function createEditor( languageCode )
92 {
93 if ( editor )
94 editor.destroy();
95
96 // Replace the <textarea id="editor"> with an CKEditor
97 // instance, using default configurations.
98 editor = CKEDITOR.replace( 'editor1',
99 {
100 language : languageCode,
101
102 on :
103 {
104 instanceReady : function()
105 {
106 // Wait for the editor to be ready to set
107 // the language combo.
108 var languages = document.getElementById( 'languages' );
109 languages.value = this.langCode;
110 languages.disabled = false;
111 }
112 }
113 } );
114 }
115
116 // At page startup, load the default language:
117 createEditor( '' );
118
119 //]]>
120 </script>
121 </p>
122 </form>
123 <div id="footer">
124 <hr />
125 <p>
126 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
127 </p>
128 <p id="copy">
129 Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
130 Knabben. All rights reserved.
131 </p>
132 </div>
133</body>
134</html>
Note: See TracBrowser for help on using the repository browser.