Parcourir la source

Other: Simplified the `Locale._t()` function.

Maciej Bukowski il y a 5 ans
Parent
commit
e188eb43a2
1 fichiers modifiés avec 3 ajouts et 6 suppressions
  1. 3 6
      packages/ckeditor5-utils/src/locale.js

+ 3 - 6
packages/ckeditor5-utils/src/locale.js

@@ -153,15 +153,12 @@ export default class Locale {
 		const hasPluralForm = !!message.plural;
 		const hasPluralForm = !!message.plural;
 		const amount = hasPluralForm ? values[ 0 ] : 1;
 		const amount = hasPluralForm ? values[ 0 ] : 1;
 
 
-		let translatedString = _translate( this.uiLanguage, message, amount );
+		const translatedString = _translate( this.uiLanguage, message, amount );
 
 
-		if ( values ) {
-			translatedString = translatedString.replace( /%(\d+)/g, ( match, index ) => {
+		return translatedString
+			.replace( /%(\d+)/g, ( match, index ) => {
 				return ( index < values.length ) ? values[ index ] : match;
 				return ( index < values.length ) ? values[ index ] : match;
 			} );
 			} );
-		}
-
-		return translatedString;
 	}
 	}
 }
 }