Przeglądaj źródła

Fixed `translate-service` fn.

Maciej Bukowski 8 lat temu
rodzic
commit
62dcb8f538

+ 2 - 1
packages/ckeditor5-utils/src/translation-service.js

@@ -59,7 +59,8 @@ export function translate( lang, translationKey ) {
 		return translationKey.replace( / \[context: [^\]]+\]$/, '' );
 	}
 
-	return dictionaries[ lang ][ translationKey ];
+	// In case of missing translations we still need to cut off the `[context: ]` parts.
+	return dictionaries[ lang ][ translationKey ].replace( / \[context: [^\]]+\]$/, '' );
 }
 
 // Checks whether the dictionary exists and translation in that dictionary exists.