PluginProbe
Slider Block by Sliderberg – Slider & Carousel Plugin for Block Editor / 1.2.3
Slider Block by Sliderberg – Slider & Carousel Plugin for Block Editor v1.2.3
1.2.3 1.2.2 1.2.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.7 1.0.8 1.0.9
sliderberg / src / __tests__ / __mocks__ / wordpressI18n.ts

wordpressI18n.ts in Slider Block by Sliderberg – Slider & Carousel Plugin for Block Editor 1.2.3, at src/__tests__/__mocks__/wordpressI18n.ts

24 lines 680 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Mock for @wordpress/i18n package
3 *
4 * Provides simple pass-through implementations of i18n functions
5 * for use in Jest tests.
6 */
7
8 export const __ = ( text: string ): string => text;
9 export const _x = ( text: string ): string => text;
10 export const _n = ( single: string, plural: string, number: number ): string =>
11 number === 1 ? single : plural;
12 export const _nx = (
13 single: string,
14 plural: string,
15 number: number
16 ): string => ( number === 1 ? single : plural );
17 export const sprintf = ( format: string, ...args: unknown[] ): string => {
18 let result = format;
19 args.forEach( ( arg ) => {
20 result = result.replace( /%[sd]/, String( arg ) );
21 } );
22 return result;
23 };
24