@@ -32,7 +32,15 @@ function enhanceWithMessages(keyPrefix, WrappedComponent) {
3232 * @param key the key of the message.
3333 * @param params an optional parameters (param0, param1 ...).
3434 */
35- getMessage = ( key , ...params ) => getMessageWithParams ( this . context , normalizedKeyPrefix + key , ...params ) ;
35+ getMessage = ( key , ...params ) => {
36+ const textKey = normalizedKeyPrefix + key ;
37+ const message = getMessageWithParams ( this . context , textKey , ...params ) ;
38+ if ( message === textKey ) {
39+ return getMessageWithParams ( this . context , key , ...params ) ;
40+ }
41+
42+ return message ;
43+ } ;
3644
3745 /**
3846 * Retrieves a text message with named parameters.
@@ -47,8 +55,15 @@ function enhanceWithMessages(keyPrefix, WrappedComponent) {
4755 * @param key the key of the message.
4856 * @param namedParams a map of named parameters.
4957 */
50- getMessageWithNamedParams = ( key , namedParams ) =>
51- getMessageWithNamedParams ( this . context , normalizedKeyPrefix + key , namedParams ) ;
58+ getMessageWithNamedParams = ( key , namedParams ) => {
59+ const textKey = normalizedKeyPrefix + key ;
60+ const message = getMessageWithNamedParams ( this . context , textKey , namedParams )
61+ if ( message === textKey ) {
62+ return getMessageWithNamedParams ( this . context , key , namedParams ) ;
63+ }
64+
65+ return message ;
66+ } ;
5267
5368 render ( ) {
5469 if ( process . env . NODE_ENV !== 'production' ) {
0 commit comments