File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 448
448
pluginLangs = pluginLangs . split ( ',' ) ;
449
449
450
450
// Resolve the plugin language. If the current language
451
- // is not available, get the first one (default one).
452
- lang = ( CKEDITOR . tools . indexOf ( pluginLangs , editor . langCode ) >= 0 ? editor . langCode : pluginLangs [ 0 ] ) ;
451
+ // is not available, get English or the first one.
452
+ if ( CKEDITOR . tools . indexOf ( pluginLangs , editor . langCode ) >= 0 )
453
+ lang = editor . langCode ;
454
+ else {
455
+ // The language code may have the locale information (zh-cn).
456
+ // Fall back to locale-less in that case (zh).
457
+ var langPart = editor . langCode . replace ( / - .* / , '' ) ;
458
+ if ( langPart != editor . langCode && CKEDITOR . tools . indexOf ( pluginLangs , langPart ) >= 0 )
459
+ lang = langPart ;
460
+ // Try the only "generic" option we have: English.
461
+ else if ( CKEDITOR . tools . indexOf ( pluginLangs , 'en' ) >= 0 )
462
+ lang = 'en' ;
463
+ else
464
+ lang = pluginLangs [ 0 ] ;
465
+ }
453
466
454
467
if ( ! plugin . langEntries || ! plugin . langEntries [ lang ] ) {
455
468
// Put the language file URL into the list of files to
Original file line number Diff line number Diff line change 23
23
editor . addCommand ( commandName , {
24
24
exec : function ( ) {
25
25
var langCode = editor . langCode ;
26
- langCode = plugin . availableLangs [ langCode ] ? langCode : 'en' ;
26
+ langCode =
27
+ plugin . availableLangs [ langCode ] ? langCode :
28
+ plugin . availableLangs [ langCode . replace ( / - .* / , '' ) ] ? langCode . replace ( / - .* / , '' ) :
29
+ 'en' ;
27
30
28
31
CKEDITOR . scriptLoader . load ( CKEDITOR . getUrl ( plugin . path + 'dialogs/lang/' + langCode + '.js' ) , function ( ) {
29
32
editor . lang . a11yhelp = plugin . langEntries [ langCode ] ;
Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ CKEDITOR.plugins.add( 'specialchar', {
23
23
editor . addCommand ( pluginName , {
24
24
exec : function ( ) {
25
25
var langCode = editor . langCode ;
26
- langCode = plugin . availableLangs [ langCode ] ? langCode : 'en' ;
26
+ langCode =
27
+ plugin . availableLangs [ langCode ] ? langCode :
28
+ plugin . availableLangs [ langCode . replace ( / - .* / , '' ) ] ? langCode . replace ( / - .* / , '' ) :
29
+ 'en' ;
27
30
28
31
CKEDITOR . scriptLoader . load ( CKEDITOR . getUrl ( plugin . path + 'dialogs/lang/' + langCode + '.js' ) , function ( ) {
29
32
CKEDITOR . tools . extend ( editor . lang . specialchar , plugin . langEntries [ langCode ] ) ;
You can’t perform that action at this time.
0 commit comments