Skip to content

Commit

Permalink
Change variable name.
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-stv committed Feb 1, 2024
1 parent 5994483 commit 0cfc719
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/ckeditor5-utils/src/translation-service.ts
Expand Up @@ -180,18 +180,18 @@ export function _translate(
throw new CKEditorError( 'translation-service-quantity-not-a-number', null, { quantity } );
}

const normalized: Translations = translations || global.window.CKEDITOR_TRANSLATIONS;
const numberOfLanguages = getNumberOfLanguages( normalized );
const normalizedTranslations: Translations = translations || global.window.CKEDITOR_TRANSLATIONS;
const numberOfLanguages = getNumberOfLanguages( normalizedTranslations );

if ( numberOfLanguages === 1 ) {
// Override the language to the only supported one.
// This can't be done in the `Locale` class, because the translations comes after the `Locale` class initialization.
language = Object.keys( normalized )[ 0 ];
language = Object.keys( normalizedTranslations )[ 0 ];
}

const messageId = message.id || message.string;

if ( numberOfLanguages === 0 || !hasTranslation( language, messageId, normalized ) ) {
if ( numberOfLanguages === 0 || !hasTranslation( language, messageId, normalizedTranslations ) ) {
if ( quantity !== 1 ) {
// Return the default plural form that was passed in the `message.plural` parameter.
return message.plural!;
Expand All @@ -200,8 +200,8 @@ export function _translate(
return message.string;
}

const dictionary = normalized[ language ].dictionary;
const getPluralForm = normalized[ language ].getPluralForm || ( n => n === 1 ? 0 : 1 );
const dictionary = normalizedTranslations[ language ].dictionary;
const getPluralForm = normalizedTranslations[ language ].getPluralForm || ( n => n === 1 ? 0 : 1 );
const translation = dictionary[ messageId ];

if ( typeof translation === 'string' ) {
Expand Down

0 comments on commit 0cfc719

Please sign in to comment.