Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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