Ticket #5303: 5303-translations.diff
File 5303-translations.diff, 2.0 KB (added by , 5 years ago) |
---|
-
cli/class-block-plugin-checker.php
841 841 } 842 842 843 843 /** 844 * Check that the plugin uses `wp_set_script_translations`. 845 */ 846 function check_for_translation_function() { 847 $functions = wp_list_pluck( $this->php_function_calls, 0 ); 848 if ( ! in_array( 'wp_set_script_translations', $functions ) ) { 849 $this->record_result( 850 __FUNCTION__, 851 'warning', 852 __( 'No translations are loaded for the scripts.', 'wporg-plugins' ), 853 $call 854 ); 855 } 856 } 857 858 /** 844 859 * Does it make PHP function calls that shouldn't be in a block plugin? 845 860 */ 846 861 function check_php_function_calls() { -
shortcodes/class-block-validator.php
317 317 return __( 'Block plugins should contain a single main block, which is added to the editor when the block is installed. If multiple blocks are used (ex: list items in a list block), the list items should set the `parent` property in their `block.json` file.', 'wporg-plugins' ); 318 318 case 'check_php_function_calls': 319 319 return __( 'Block plugins should contain minimal PHP with no UI outside the editor. JavaScript should be used instead of PHP where possible.', 'wporg-plugins' ); 320 case 'check_for_translation_function': 321 return sprintf( 322 // translators: %s is the link to the internationalization docs. 323 __( 'Block plugins should use <code>wp_set_script_translations</code> to load translations for each script file. <a href="%s">Learn more about internationalization.</a>', 'wporg-plugins' ), 324 'https://developer.wordpress.org/block-editor/developers/internationalization/' 325 ); 320 326 // This is a special case, since multiple values may be collapsed. 321 327 case 'check_block_json_is_valid': 322 328 return false;