Skip to content

Commit 53c99ea

Browse files
committed
Rename i18n function
It clashes with a Calypso i18n webpack plugin, so the simplest is to rename the function
1 parent 76d09d5 commit 53c99ea

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

web/packages/hovercards/src/core.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Placement } from './assign-position';
22
import assignPosition from './assign-position';
33
import { escUrl, escHtml } from './sanitizer';
44
import addQueryArg from './add-query-arg';
5-
import __ from './i18n';
5+
import __t from './i18n';
66

77
interface AccountData {
88
service_type: string;
@@ -363,24 +363,24 @@ export default class Hovercards {
363363
if ( nonEmptyContacts.length || hasPayments ) {
364364
if ( nonEmptyContacts.length ) {
365365
ctaButtons += `
366-
<button class="gravatar-hovercard__button" data-target-drawer="contact">${ __( i18n, 'Contact' ) }</button>
366+
<button class="gravatar-hovercard__button" data-target-drawer="contact">${ __t( i18n, 'Contact' ) }</button>
367367
`;
368368

369369
contactsDrawer = Hovercards._createDrawer(
370370
'contact',
371-
__( i18n, 'Contact' ),
371+
__t( i18n, 'Contact' ),
372372
Hovercards._createContactDrawerContent( nonEmptyContacts )
373373
);
374374
}
375375

376376
if ( hasPayments ) {
377377
ctaButtons += `
378-
<button class="gravatar-hovercard__button" data-target-drawer="send-money">${ __( i18n, 'Send money' ) }</button>
378+
<button class="gravatar-hovercard__button" data-target-drawer="send-money">${ __t( i18n, 'Send money' ) }</button>
379379
`;
380380

381381
sendMoneyDrawer = Hovercards._createDrawer(
382382
'send-money',
383-
__( i18n, 'Send money' ),
383+
__t( i18n, 'Send money' ),
384384
Hovercards._createSendMoneyDrawerContent( payments )
385385
);
386386
}
@@ -426,7 +426,7 @@ export default class Hovercards {
426426
href="${ isEditProfile ? 'https://gravatar.com/profiles/edit?utm_source=hovercard' : trackedProfileUrl }"
427427
target="_blank"
428428
>
429-
${ isEditProfile ? __( i18n, 'Edit your profile →' ) : __( i18n, 'View profile →' ) }
429+
${ isEditProfile ? __t( i18n, 'Edit your profile →' ) : __t( i18n, 'View profile →' ) }
430430
</a>
431431
</div>
432432
${ contactsDrawer }
@@ -801,17 +801,17 @@ export default class Hovercards {
801801
this._onHovercardShown( hash, hovercard );
802802
} )
803803
.catch( ( code ) => {
804-
let message = __( this._i18n, 'Sorry, we are unable to load this Gravatar profile.' );
804+
let message = __t( this._i18n, 'Sorry, we are unable to load this Gravatar profile.' );
805805

806806
switch ( code ) {
807807
case 404:
808-
message = __( this._i18n, 'Profile not found.' );
808+
message = __t( this._i18n, 'Profile not found.' );
809809
break;
810810
case 429:
811-
message = __( this._i18n, 'Too Many Requests.' );
811+
message = __t( this._i18n, 'Too Many Requests.' );
812812
break;
813813
case 500:
814-
message = __( this._i18n, 'Internal Server Error.' );
814+
message = __t( this._i18n, 'Internal Server Error.' );
815815
break;
816816
}
817817

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export default function __( i18n: Record< string, string >, key: string ) {
1+
export default function __t( i18n: Record< string, string >, key: string ) {
22
return i18n[ key ] || key;
33
}

0 commit comments

Comments
 (0)