1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
\r
3 Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
\r
4 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
6 <html xmlns="http://www.w3.org/1999/xhtml">
\r
8 <title>User Interface Globalization — CKEditor Sample</title>
\r
9 <meta content="text/html; charset=utf-8" http-equiv="content-type" />
\r
10 <script type="text/javascript" src="../ckeditor.js"></script>
\r
11 <script type="text/javascript" src="../lang/_languages.js"></script>
\r
12 <script src="sample.js" type="text/javascript"></script>
\r
13 <link href="sample.css" rel="stylesheet" type="text/css" />
\r
16 <h1 class="samples">
\r
17 CKEditor Sample — User Interface Languages
\r
19 <div class="description">
\r
21 This sample shows how to automatically replace <code><textarea></code> elements
\r
22 with a CKEditor instance with an option to change the language of its user interface.
\r
25 It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates
\r
26 a drop-down list that lets the user change the UI language.
\r
29 By default, CKEditor automatically localizes the editor to the language of the user.
\r
30 The UI language can be controlled with two configuration options:
\r
31 <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.language">
\r
32 <code>language</code></a> and <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.defaultLanguage">
\r
33 <code>defaultLanguage</code></a>. The <code>defaultLanguage</code> setting specifies the
\r
34 default CKEditor language to be used when a localization suitable for user's settings is not available.
\r
37 To specify the user interface language that will be used no matter what language is
\r
38 specified in user's browser or operating system, set the <code>language</code> property:
\r
40 <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
\r
42 // Load the German interface.
\r
43 <strong>language: 'de'</strong>
\r
46 Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
\r
47 the <code><textarea></code> element to be replaced.
\r
50 <!-- This <div> holds alert messages to be display in the sample page. -->
\r
54 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
\r
55 support, like yours, you should still see the contents (HTML data) and you should
\r
56 be able to edit it normally, without a rich editor interface.
\r
60 <form action="sample_posteddata.php" method="post">
\r
62 Available languages (<span id="count"> </span> languages!):<br />
\r
63 <script type="text/javascript">
\r
65 document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );
\r
66 // Get the language list from the _languages.js file.
\r
67 for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ )
\r
70 '<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
\r
71 window.CKEDITOR_LANGS[i].name +
\r
74 document.write( '</select>' );
\r
78 <span style="color: #888888">(You may see strange characters if your system does not
\r
79 support the selected language)</span>
\r
82 <textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
\r
83 <script type="text/javascript">
\r
86 // Set the number of languages.
\r
87 document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
\r
91 function createEditor( languageCode )
\r
96 // Replace the <textarea id="editor"> with an CKEditor
\r
97 // instance, using default configurations.
\r
98 editor = CKEDITOR.replace( 'editor1',
\r
100 language : languageCode,
\r
104 instanceReady : function()
\r
106 // Wait for the editor to be ready to set
\r
107 // the language combo.
\r
108 var languages = document.getElementById( 'languages' );
\r
109 languages.value = this.langCode;
\r
110 languages.disabled = false;
\r
116 // At page startup, load the default language:
\r
117 createEditor( '' );
\r
126 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
\r
129 Copyright © 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
\r
130 Knabben. All rights reserved.
\r