Repository navigation
Add ability to specify a different default editor font per locale - #11826
Merged
Merged
Conversation
11 tasks
Using the language translation, allows specifying a different Google font to load and what the CSS font-family should be.
mkaz
force-pushed
the
try/localized-fonts
branch
from
November 14, 2018 05:23
27df5b5 to
0bc1dc2
Compare
georgeh
approved these changes
Nov 19, 2018
georgeh
left a comment
Contributor
There was a problem hiding this comment.
Tested and confirmed that I was able to change the editor font using localization tools.
If this becomes a more common thing, we may want to look at making localized CSS part of the build process, but for now this should solve the current issues with minimal overhead.
Member
Author
|
Core ticket: https://core.trac.wordpress.org/ticket/45382#ticket |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 Variantswhich can be set tooffto 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 Fontwhich is the css font-family name specified in the Google font loaded. The default value is:Noto SerifThis 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.poIf you use Homebrew on OSX, you may need to run
brew link gettext --forceto 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: