Add ability to specify a different default editor font per locale #11826
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Allow translators to specifying a different default font based on the language/locale. The translator can specify a different Google font to load, and what the CSS font-family should be for different locales.
Fixes #9891
Types of changes
Adds two new translation fields to allow language translation to specify a default font.
The first field is
Google Font Name and Variants
which can be set tooff
to disable loading an external Google font. The default value is: `Noto Serif:400,400i,700,700i'The second field is
CSS Font Family for Editor Font
which is the css font-family name specified in the Google font loaded. The default value is:Noto Serif
This includes the variants because certain fonts may not support italics, for example Noto Sans JP.
The second field could also be used to specify a default system font.
How to Test
Confirm the Editor default text is using the Noto Serif font.
Generate a gutenberg.pot file using makepot.php from core See i18n
Copy gutenberg.pot to gutenberg-es_MX.po
Edit gutenberg-es_MX.po and change the fields, here's the example I used
Generate the mo file using
msgfmt -o gutenberg-es_MX.mo gutenberg-es_MX.po
If you use Homebrew on OSX, you may need to run
brew link gettext --force
to add the msgfmt binary.Go to Settings > General and change your site Language to Espanol de Mexico
This may require first adding
define( 'WPLANG', 'es_MX' );
to your wp-config.php.Finally confirm the default editor font is changed to Pacifico, which is a distinct script font.
You can obviously test using a different locale and font to match what works best for your language.
Checklist: