Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Define different fonts for different languages

Posted on 2014-02-05
8
Medium Priority
?
439 Views
Last Modified: 2014-02-19
My site is using 3.8.1 Wordpress, and it is multilangual site (Some pages are English, some Dutch, and some Arabic).
Is it possible to assign to different font families to different languages?
I have tried to add an import at the end of the style.css for the arabic font but it has cancelled the English font, is it possible to solve it?
0
Comment
Question by:Ashraf Hassanein
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 29

Expert Comment

by:chilternPC
ID: 39837238
I would have a style sheet (style.css) for each language and then place it where you choose which language.
it really depends on what plugin or method you use to switch languages
0
 
LVL 15

Accepted Solution

by:
eemit earned 2000 total points
ID: 39837253
Try this in your child theme functions.php:

/**
 * Enqueues scripts and styles for front-end.
 *
 */
add_action( 'wp_enqueue_scripts', 'yourchildthemeprefix_scripts_styles', 11 );
function yourchildthemeprefix_scripts_styles() {

	/*
	 * Loads our main stylesheet.
	 */
	wp_enqueue_style( 'yourchildthemeprefix-style', get_stylesheet_directory_uri() . '/style.css', array(), '20140205' );

	// If it is a multisite use this
	//$blog_language = get_bloginfo('language');
	//if ( $blog_language == "de-DE" ) {
	// If it is not a multisite use this
	if ( is_page( 'your-page-slug-whith-de' )  )     {
		wp_enqueue_style( 'yourchildthemeprefix-de', get_stylesheet_directory_uri() . '/css/de.css', array( 'yourchildthemeprefix-style' ), '20140205' );
	} else {
		wp_enqueue_style( 'yourchildthemeprefix-en', get_stylesheet_directory_uri() . '/css/en.css', array( 'yourchildthemeprefix-style' ), '20140205' );
	}
}

Open in new window


Adapt it to your languages and your pages.
0
 

Author Comment

by:Ashraf Hassanein
ID: 39842109
But do I need to append the page names with the languages? Also do I need to put in the de.css and en.css only the font or every thing in the style.css?
0
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
LVL 29

Expert Comment

by:chilternPC
ID: 39842136
not sure I understand    "But do I need to append the page names with the languages? "
you say you have pages in different languages, so I would create a style sheet for each language and in those style sheets have the changes you want for than language.
then put those style sheets in the place where the language is chosen.
depends on what multi lingual plug in you are using.
0
 
LVL 29

Expert Comment

by:chilternPC
ID: 39842174
in your header.php (after the inclusion of style.css) you could add this code:

$mylanguage = get_bloginfo('language');
if($mylanguage == 'en-US') {
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/enstyle.css" media="screen" type="text/css" />
}
elseif($mylanguage == 'fr-FR'){
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/frstyle.css" media="screen" type="text/css" />
}
0
 

Author Comment

by:Ashraf Hassanein
ID: 39842220
I am very very sorry for my stupid question,  my website currently has both Arabic and English
In the navigation menu I have in one menu items in English and the items in Arabic, how the the wordpress will now which font to use for each item? does it detect the character set?
0
 
LVL 15

Expert Comment

by:eemit
ID: 39842455
But do I need to append the page names with the languages
No you don't need  to append the page names e.g.
is_page( 'here-only-your-page slug' )
The same for wp_enqueue_style e.g.:
wp_enqueue_style( 'here-only-your-unic-name-for-style',

Also do I need to put in the de.css and en.css only the font or every thing in the style.css?

Only the font.

You don't need  to change your header.php

Put your language css files in css subfolder in your child theme.
Yuo don't need any language code in your css file names.
0
 

Author Comment

by:Ashraf Hassanein
ID: 39872633
Finally I managed to implement different fonts for different languages.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question