?
Solved

Define different fonts for different languages

Posted on 2014-02-05
8
Medium Priority
?
428 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
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.

 
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

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
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 basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 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