Ollie Theme Academy

Creating Block Patterns

Using patterns for internationalization – A

Block themes require workarounds for text internationalization since the site editor doesn’t natively support translation functions. Pattern PHP files provide the solution.

Use esc_html__() for simple text internationalization within HTML contexts. For content containing HTML tags, use a two-step process: __() for translation followed by wp_kses_post() for sanitization.

The key is breaking pattern strings appropriately to insert PHP function calls while maintaining valid serialized block markup. Proper concatenation ensures the pattern remains functional.

This approach enables full internationalization capabilities in block themes using familiar WordPress translation functions within pattern files.

Back to: Ollie Theme Academy > Creating Block Patterns