Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow translators to disable theme font famlies that do not support specific languages #67311

Open
carolinan opened this issue Nov 26, 2024 · 0 comments
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Enhancement A suggestion for improvement.

Comments

@carolinan
Copy link
Contributor

What problem does this address?

This was first brought up on the WordPress Slack (Account needed).

Bundled classic themes followed a practice where, if a font family did not support a language, the translators were able to disable the font.

This was made possible with a PHP condition:

if ( ! function_exists( 'twentyseventeen_fonts_url' ) ) :
	/**
	 * Register custom fonts.
	 *
	 * @since Twenty Seventeen 1.0
	 * @since Twenty Seventeen 3.2 Replaced Google URL with self-hosted fonts.
	 *
	 * @return string Fonts URL for the theme.
	 */
	function twentyseventeen_fonts_url() {
		$fonts_url = '';

		/*
		 * translators: If there are characters in your language that are not supported
		 * by Libre Franklin, translate this to 'off'. Do not translate into your own language.
		 */
		$libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'twentyseventeen' );

		if ( 'off' !== $libre_franklin ) {
			$fonts_url = get_template_directory_uri() . '/assets/fonts/font-libre-franklin.css';
		}

		return esc_url_raw( $fonts_url );
	}
endif;

https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-content/themes/twentyseventeen/functions.php#L285C1-L309C7

In block themes that add font families to theme.json, translators can translate the font name, but they have no way to disable the font.
Translators have shared that this is a missing feature, which is why I am opening this issue.

What is your proposed solution?

I am not sure how to solve this.
I believe the theme developer should list the subsets as part of the font family declaration in theme.json. This is not possible today.
But after that I am not sure how the translators would be able to use that information.

@carolinan carolinan added [Type] Enhancement A suggestion for improvement. Internationalization (i18n) Issues or PRs related to internationalization efforts labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

1 participant