Opened 22 months ago
Closed 20 months ago
#57807 closed enhancement (wontfix)
Twenty Twelve and Twenty Fifteen: maintain font subset translations
Reported by: | sabernhardt | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.2 |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | Cc: |
Description
Changesets [55277] and [55268] removed font subset translations from the font URL functions because the subsets do not affect the new URLs. Google Fonts had supported all character sets regardless of the URL query string, and the new stylesheets also serve any character sets (without a query string).
However, developers may have a use for the subset information in a custom stylesheet or in a preload
resource link.
Change History (6)
This ticket was mentioned in PR #4135 on WordPress/wordpress-develop by @sabernhardt.
22 months ago
#1
- Keywords has-patch added
#2
@
22 months ago
I first tried returning an array with Latin characters, including any extended subsets, but simpler may be better. Returning the string (translation) lets developers decide exactly what to do with the output. Someone who wants an array could build one from the string.
I do not think creating similar functions in the other themes is very valuable. If I'm wrong about that, we could open another ticket to add them in a future release.
This is not a bug ticket because it would create new functions. Maybe it could be a task for 6.2, though.
#3
@
22 months ago
I was worried about possibly losing the translations, but checking known language codes might be better anyway.
Looking at no-subset
translations again, the collection only seems reliable for a few—yet not all—Cyrillic languages. Most translations are either the default no-subset
or else invalid translations of the word instead of the setting (including Greek and Vietnamese).
Valid, non-default translations:
- Twenty Twelve has
cyrillic
for eight languages: Belarusian, Bengali, Korean(?), Kyrgyz, Russian, Serbian, Ukrainian and Uzbek. Belarusian, Bengali and Korean turned off the Open Sans font anyway. - Twenty Fifteen has
devanagari
for Bengali andcyrillic
for four languages: Belarusian, Bulgarian, Russian and Serbian. Bengali and Belarusian disable all the packaged theme fonts; Russian and Serbian only turn off Inconsolata.
Notes:
- Devanagari was not an option for Twenty Twelve's Open Sans, but these proposed functions are not only for sites with the default font selection(s).
- Irish and Lithuanian specify
latin-ext
, which technically was invalid in the original stylesheet functions, though it might have some use with these.
#4
@
22 months ago
- Keywords close 2nd-opinion added
The dev note for #55985 could recommend using something like Twenty Twenty's language code collection for any of the six themes edited on that ticket instead of having a separate method for these two.
Side note: Twenty Twenty should be updated to include at least Persian (Afghanistan) and Uzbek.
#5
@
22 months ago
Example of a language code array (for themes without these proposed functions):
<?php $script_families = array( // Cyrillic. 'bel' => 'cyrillic', 'bg-BG' => 'cyrillic', 'kk' => 'cyrillic', 'mk-MK' => 'cyrillic', 'mn' => 'cyrillic', 'ru-RU' => 'cyrillic', 'sah' => 'cyrillic', 'sr-RS' => 'cyrillic', 'tt-RU' => 'cyrillic', 'uk' => 'cyrillic', 'uz-UZ' => 'cyrillic', // Devanagari. 'bn-BD' => 'devanagari', 'hi-IN' => 'devanagari', 'mr' => 'devanagari', 'ne-NP' => 'devanagari', // Greek. 'el' => 'greek', // Hebrew. 'he-IL' => 'hebrew', // Vietnamese. 'vi' => 'vietnamese', ); $locale = get_bloginfo( 'language' ); if ( array_key_exists( $locale, $script_families ) ) { // Do something with the special script family name. echo $script_families[$locale]; }
Creates new functions to output the string from
no-subset
translations that previously were included in Twenty Twelve and Twenty Fifteen.Trac 57807