ckeditor/samples/old/uilanguages.html
changeset 0 44d330dccc59
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ckeditor/samples/old/uilanguages.html	Thu Dec 15 18:10:20 2016 +0300
     1.3 @@ -0,0 +1,122 @@
     1.4 +<!DOCTYPE html>
     1.5 +<!--
     1.6 +Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
     1.7 +For licensing, see LICENSE.md or http://ckeditor.com/license
     1.8 +-->
     1.9 +<html>
    1.10 +<head>
    1.11 +	<meta charset="utf-8">
    1.12 +	<title>User Interface Globalization &mdash; CKEditor Sample</title>
    1.13 +	<script src="../../ckeditor.js"></script>
    1.14 +	<script src="assets/uilanguages/languages.js"></script>
    1.15 +	<link rel="stylesheet" href="sample.css">
    1.16 +</head>
    1.17 +<body>
    1.18 +	<h1 class="samples">
    1.19 +		<a href="index.html">CKEditor Samples</a> &raquo; User Interface Languages
    1.20 +	</h1>
    1.21 +	<div class="warning deprecated">
    1.22 +		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>.
    1.23 +	</div>
    1.24 +	<div class="description">
    1.25 +		<p>
    1.26 +			This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements
    1.27 +			with a CKEditor instance with an option to change the language of its user interface.
    1.28 +		</p>
    1.29 +		<p>
    1.30 +			It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates
    1.31 +			a drop-down list that lets the user change the UI language.
    1.32 +		</p>
    1.33 +		<p>
    1.34 +			By default, CKEditor automatically localizes the editor to the language of the user.
    1.35 +			The UI language can be controlled with two configuration options:
    1.36 +			<code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-language">language</a></code> and
    1.37 +			<code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-defaultLanguage">
    1.38 +			defaultLanguage</a></code>. The <code>defaultLanguage</code> setting specifies the
    1.39 +			default CKEditor language to be used when a localization suitable for user's settings is not available.
    1.40 +		</p>
    1.41 +		<p>
    1.42 +			To specify the user interface language that will be used no matter what language is
    1.43 +			specified in user's browser or operating system, set the <code>language</code> property:
    1.44 +		</p>
    1.45 +<pre class="samples">
    1.46 +CKEDITOR.replace( '<em>textarea_id</em>', {
    1.47 +	// Load the German interface.
    1.48 +	<strong>language: 'de'</strong>
    1.49 +});</pre>
    1.50 +		<p>
    1.51 +			Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
    1.52 +			the <code>&lt;textarea&gt;</code> element to be replaced.
    1.53 +		</p>
    1.54 +	</div>
    1.55 +	<form action="sample_posteddata.php" method="post">
    1.56 +		<p>
    1.57 +			Available languages (<span id="count"> </span> languages!):<br>
    1.58 +			<script>
    1.59 +
    1.60 +				document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );
    1.61 +
    1.62 +				// Get the language list from the _languages.js file.
    1.63 +				for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ ) {
    1.64 +					document.write(
    1.65 +						'<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
    1.66 +							window.CKEDITOR_LANGS[i].name +
    1.67 +						'</option>' );
    1.68 +				}
    1.69 +
    1.70 +				document.write( '</select>' );
    1.71 +
    1.72 +			</script>
    1.73 +			<br>
    1.74 +			<span style="color: #888888">
    1.75 +				(You may see strange characters if your system does not support the selected language)
    1.76 +			</span>
    1.77 +		</p>
    1.78 +		<p>
    1.79 +			<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>
    1.80 +			<script>
    1.81 +
    1.82 +				// Set the number of languages.
    1.83 +				document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
    1.84 +
    1.85 +				var editor;
    1.86 +
    1.87 +				function createEditor( languageCode ) {
    1.88 +					if ( editor )
    1.89 +						editor.destroy();
    1.90 +
    1.91 +					// Replace the <textarea id="editor"> with an CKEditor
    1.92 +					// instance, using default configurations.
    1.93 +					editor = CKEDITOR.replace( 'editor1', {
    1.94 +						language: languageCode,
    1.95 +
    1.96 +						on: {
    1.97 +							instanceReady: function() {
    1.98 +								// Wait for the editor to be ready to set
    1.99 +								// the language combo.
   1.100 +								var languages = document.getElementById( 'languages' );
   1.101 +								languages.value = this.langCode;
   1.102 +								languages.disabled = false;
   1.103 +							}
   1.104 +						}
   1.105 +					});
   1.106 +				}
   1.107 +
   1.108 +				// At page startup, load the default language:
   1.109 +				createEditor( '' );
   1.110 +
   1.111 +			</script>
   1.112 +		</p>
   1.113 +	</form>
   1.114 +	<div id="footer">
   1.115 +		<hr>
   1.116 +		<p>
   1.117 +			CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
   1.118 +		</p>
   1.119 +		<p id="copy">
   1.120 +			Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
   1.121 +			Knabben. All rights reserved.
   1.122 +		</p>
   1.123 +	</div>
   1.124 +</body>
   1.125 +</html>