Parcourir la source

Fixed `translate-service` fn.

Maciej Bukowski il y a 8 ans
Parent
commit
62dcb8f538
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      packages/ckeditor5-utils/src/translation-service.js

+ 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.