Skip to content

Create localized versions of the templates and template parts #46

@bobbingwide

Description

@bobbingwide

Full Site Editing themes should support internationalization (i18n) and localization (l10n).

The process to extract and localize is summarized by this diagram.

screenshot

Requirements

  • To be able to use the Fizzie theme in the user's selected locale.
  • To automatically extract and localize templates and template parts.
  • Test with two additional languages:
  1. UK English - locale en_GB
  2. bbboing's language bb_BB

Proposed solution

Requirements on Gutenberg

  • Gutenberg's template and template loading logic needs to be updated to take into account the user's locale.
  • The translated files will be stored in subfolders of the languages folder, with one directory per supported locale.
  • If the directory isn't present the US English files are used.

Assumptions, scope, exclusions and caveats

  • Templates and template parts are inherently static; they don't implement conditional / looping logic.
  • Internationalization (i18n) of the templates and template parts is only necessary for certain strings which should not be translated.
  • As such, localized versions can be created at build time, or whenever the translations are updated.
  • Blocks used in templates and template parts may implement conditional / looping logic.
  • These blocks are usually server side rendered using PHP.
  • A theme's PHP code will be localized using makepot.
  • Any JavaScript blocks delivered by the theme will be localized using makejson.
  • The solution should support all locales and character sets currently supported by WordPress.
  • The solution should support themes which are not delivered from wordpress.org

Limitations of the prototyped solution

  • t10n.bat is currently dependent upon oik-batch's oik
  • The current routines are prototyped batch routines which echo debug information.
  • Not all scenarios are yet catered for by the routines invoked by t10n.
  • The current solution doesn't merge .pot files into one file prior to translation.
  • But text strings used in PHP and template files and parts are not expected to be the same.
  • So there shouldn't be too many duplicate strings to translate.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions