Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 't/9688b'
  • Loading branch information
fredck committed Nov 21, 2012
2 parents 4f213b5 + 21fb447 commit e096626
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 15 additions & 2 deletions core/editor.js
Expand Up @@ -448,8 +448,21 @@
pluginLangs = pluginLangs.split( ',' );

// Resolve the plugin language. If the current language
// is not available, get the first one (default one).
lang = ( CKEDITOR.tools.indexOf( pluginLangs, editor.langCode ) >= 0 ? editor.langCode : pluginLangs[ 0 ] );
// is not available, get English or the first one.
if ( CKEDITOR.tools.indexOf( pluginLangs, editor.langCode ) >= 0 )
lang = editor.langCode;
else {
// The language code may have the locale information (zh-cn).
// Fall back to locale-less in that case (zh).
var langPart = editor.langCode.replace( /-.*/, '' );
if ( langPart != editor.langCode && CKEDITOR.tools.indexOf( pluginLangs, langPart ) >= 0 )
lang = langPart;
// Try the only "generic" option we have: English.
else if ( CKEDITOR.tools.indexOf( pluginLangs, 'en' ) >= 0 )
lang = 'en';
else
lang = pluginLangs[ 0 ];
}

if ( !plugin.langEntries || !plugin.langEntries[ lang ] ) {
// Put the language file URL into the list of files to
Expand Down
5 changes: 4 additions & 1 deletion plugins/a11yhelp/plugin.js
Expand Up @@ -23,7 +23,10 @@
editor.addCommand( commandName, {
exec: function() {
var langCode = editor.langCode;
langCode = plugin.availableLangs[ langCode ] ? langCode : 'en';
langCode =
plugin.availableLangs[ langCode ] ? langCode :
plugin.availableLangs[ langCode.replace( /-.*/, '' ) ] ? langCode.replace( /-.*/, '' ) :
'en';

CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( plugin.path + 'dialogs/lang/' + langCode + '.js' ), function() {
editor.lang.a11yhelp = plugin.langEntries[ langCode ];
Expand Down
5 changes: 4 additions & 1 deletion plugins/specialchar/plugin.js
Expand Up @@ -23,7 +23,10 @@ CKEDITOR.plugins.add( 'specialchar', {
editor.addCommand( pluginName, {
exec: function() {
var langCode = editor.langCode;
langCode = plugin.availableLangs[ langCode ] ? langCode : 'en';
langCode =
plugin.availableLangs[ langCode ] ? langCode :
plugin.availableLangs[ langCode.replace( /-.*/, '' ) ] ? langCode.replace( /-.*/, '' ) :
'en';

CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( plugin.path + 'dialogs/lang/' + langCode + '.js' ), function() {
CKEDITOR.tools.extend( editor.lang.specialchar, plugin.langEntries[ langCode ] );
Expand Down

0 comments on commit e096626

Please sign in to comment.