-
AuthorPosts
-
August 15, 2014 at 2:31 am #304666
Hello,
I am trying to translate http://www.franchiseelites.com to different languages using WPML plugin. I started with Farsi which is a RTL language. I have a couple of problems and I am going to ask all of them if you don’t mind in one post:
1) I know there is a rtl.css file in enfold. Should I do anything to tell my pages use that file or when I translate a page to Farsi it automatically starts using it?
2) I am trying to use a different font in Farsi pages using bellow code:
@font-face {
font-family:”BBCNassim”;
src: url( “http://f.manmote.com/font/BBCNassim.eot” );
src: local( “☺” ),
url( “http://f.manmote.com/font/BBCNassim.woff” )
format( “woff” ),
url( “http://f.manmote.com/font/BBCNassim.ttf” )
format( “truetype” );
}
.page-id-1233 { font-family: “BBCNassim” !important;
}.page-id-1233 h1, h2, h3, h4, h5, h6, socket, footer, header, caption { font-family: “BBCNassim”, “Tahoma”!important;
}However I have a couple of problems. The font doesn’t appear on IE and FireFox and it is only good on Chrome. Also Icon Caption doesn’t use that font. How can I apply that font to the whole Farsi website? How Can I solve appearance problem in IE and Firefox?
3) In the Farsi version of my Home page there is a gap above my header which is back and as I start scrolling it becomes transparent. it doesn’t have anything to do with being logged in wordpress. I don’t have the same problem with English version. please help me correct this.
August 15, 2014 at 9:35 am #304766Hey afarahani!
1) We use the is_rtl() function: http://codex.wordpress.org/Function_Reference/is_rtl to check if a rtl language is used or not. Normally wordpress (and WPML) should take care of it and load the rtl stylesheet file. Your website ( http://www.franchiseelites.com/fa/ ) loads the rtl.css file.
2) Maybe it’s a cross domain origin issue. To solve it follow the instructions here: http://davidwalsh.name/cdn-fonts or here: http://www.unseenrevolution.com/solution-firefox-font-face-cross-domain-problem/
3) Please check the styling settings of the Farsi website – maybe you set a black background color for the header? Go to Enfold (Fa) > Theme Options to set the settings for the Farsi website.
Best regards,
PeterAugust 15, 2014 at 6:38 pm #305017Hi Peter,
Thanks for the tips.
1) Are you sure that the page is using rtl.css? social icons and address on the top are still LTR similar to english version. Also in mobile version, the page loads from left to right. Check the icon boxes in the middle of the page. I have tried to arrange them from right to left but in mobild version, it is loaded left to right.
2) I need help as when I wanted to add the code to the htaccess file I messed it up. Please let me know how I should change the code to solve my problem. What should I put for filename? Are you sure this solves the font problem with IE?
php_value magic_quotes_gpc 0
Header set Access-Control-Allow-Origin “*”
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
add_header Access-Control-Allow-Origin *;
}2- regarding the gap above the header I haven’t set anything. As I told you the header is set somehow to be bellow the top of the screen. when you scroll the page down you can see though that gap. check it here: http://www.franchiseelites.com/fa/
thanks,
AmirAugust 15, 2014 at 7:33 pm #305047Another question that I have is that can I put the font on my server and load theme from there? Does that solve the issue? If yes can you let me know where I can put the fonts and how to call theme in the CSS code?
August 15, 2014 at 8:07 pm #305058Hi!
Try using this code instead for the font-face:
@font-face { font-family: 'BBCNassim'; src: url( "http://f.manmote.com/font/BBCNassim.eot" ); src: url('http://f.manmote.com/font/BBCNassim.eot?#iefix') format('embedded-opentype'), url('http://f.manmote.com/font/BBCNassim.woff') format('woff'), url('http://f.manmote.com/font/BBCNassim.ttf') format('truetype'); }
Regards,
JosueAugust 15, 2014 at 10:13 pm #305096Hi Josue,
I have been waiting for you to step up man! Happy to have you here.
1) Unfortunately, the code still doesn’t work with IE (at least in my browser) and the font appears different in IE than in Chrome.
Any idea?
2) Although the Font appears good in Chrome still Icon Box caption and drop down menu in Contact Form (see the last row in the bottom of the page) dosn’t use the defined Font. What is the command for IconBox Caption and Contact Form Drop Down Menu?
3) Also take a look at this post https://kriesi.at/support/topic/wpml-language-switcher-and-header-arrangment/
Still I have problem with the transparent space above my header in Farsi version. Do you know how to fix it?
Thanks
AmirAugust 15, 2014 at 10:20 pm #305099I referred to a wrong page regarding the last point. It is in this page above.
Another point! The strip above the header that contains the social icon has not changed to RTL? Is there any fix for it too?
August 15, 2014 at 10:27 pm #305101Hi!
That space is coming from this text you have here in the source:
I’m not sure how it got there, try checking in the header.php file.
Regarding the icons, can you please create a mockup/screenshot of how they should look in RTL?
Cheers!
JosueAugust 15, 2014 at 11:03 pm #305111Hi Josue,
Thanks for your quick response.
1) First of all I found a work around for the font face problem in IE. I transferred the fonts on my server and added following code to htaccess file and seems the font appears fine on IE and Firefox. So please don’t put your time on it.
# BEGIN REQUIRED FOR WEBFONTSAddType font/ttf .ttf
AddType font/eot .eot
AddType font/otf .otf
AddType font/woff .woff<FilesMatch “\.(ttf|otf|eot|woff)$”>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin “*”
</IfModule>
</FilesMatch># END REQUIRED FOR WEBFONTS
2) I had the !important in my quick CSS. I have to put those to force farsi pages use my new font and not the theme fonts instead. when I remove them the theme doesnt use my font!!!
.page-id-1233 { font-family: ‘BBCNassim’, Tahoma !important;
}
.page-id-1233 h1, h2, h3, h4, h5, h6, socket, footer, header, caption { font-family: ‘BBCNassim’, Tahoma !important;
}Is there any way to tell the theme use my new font for all farsi pages instead of above codes I am currently using?
Nevertheless, when I removed both “!important” the gap didn’t appear !???
3) I added the same text of icon box caption in a text box under each one. Take a look at the website know (http://www.franchiseelites.com/fa/
The problem is the code I used for forcing the farsi pages to use my font doen’t work on every element.including icon caption, drop down menu of contact from, etc. Is there any way to apply it to every this in Farsi pages?
4) I still have problem with Mobile RTL view. in mobile the page is shown by order from left to right and not right to left as in desktop version.
Thanks
AmirAugust 15, 2014 at 11:14 pm #305112Hey Amir!
Try with this code:
html[lang="fa-IR"] *{ font-family: 'BBCNassim' !important; }
To fix the social bookmarks:
@media only screen and (min-width: 767px) { #top.rtl .social_bookmarks li { float: right; } }
Cheers!
JosueAugust 15, 2014 at 11:28 pm #305114Josue,
Great help from you today :)
I found the source of problem with the gap. You were right. I couldn’t have fixed it without knowing the point you told me.
Using above code, the font problem solved for every part of my page. Excellent Josue!
One problem that still is there, is the problem with mobile devices. In mobile view text boxes and icon boxes are shown one after another in an order that is shown left to right in desktop version. How do I solve this?
Thanks,
AmirAugust 16, 2014 at 1:29 am #305140Hi Amir!
I’m not sure if i could note it, but i checked the iconboxes you have on your homepage and they keep the same structure in desktop and mobile (people > graph > plane):
Best regards,
JosueAugust 16, 2014 at 1:34 am #305142Josue,
As Farsi is a RTL langiage, the box which is on the right side in desktop view should come first on the top in mobile view, then the middle box and them the left box at the bottom. But what happens right now is the opposite i.e. the left box comes first on top (similar to English version).
Bests,
AmirAugust 16, 2014 at 1:36 am #305143the order should be plane>graph>phone !
August 16, 2014 at 1:46 am #305147I see, the easiest way to fix that would be to simply swap the order in the layout builder for the Farsi version.
Regards,
JosueAugust 16, 2014 at 1:54 am #305149But if I do that the order in desk top version will not be correct.
desktop should be people-graph-plane in which plane is on the right end side and people on the left end side.
mobile should come with
plane (on the top)
graph
peopleConfusing? right?
I think the rtl.css or some other file that deals with showing the mobile version should be changes for RTL language.Please let me know what should be change in which one?
Thanks,
AmirAugust 16, 2014 at 2:36 am #305153Hi Amir!
I understand now, but that’s definitely not possible to do in CSS level, it would require some JavaScript to swap them automatically. As an alternative, you could create two version of those three icons (one for mobiles, one for desktop, wrapped in color section with different IDs) and hide them accordingly:
#onlymobile{ display: none; } @media only screen and (max-width: 767px) { #onlymobile{ display: block; } #onlydesktop{ display: none; } }
Regards,
JosueAugust 17, 2014 at 6:18 am #305392Thanks Josue,
I have several pages that contain 3 columns and what you are saying is to create two versions for each of them and add the code to hide or show them them on each page. As this is a serious issue with the Enfold RTL support, is there anyway to fix it for good?
Amir
August 17, 2014 at 8:22 am #305401Hey Amir!
I found a better workaround, try adding this at the very end of your theme functions.php file:
function rtl_columns_fix(){ ?> <script> (function($){ var resizeTimeout, sortedReverse = false; $(window).resize(function () { if (resizeTimeout) { window.clearTimeout(resizeTimeout); } resizeTimeout = window.setTimeout(function () { var windowWidth = window.innerWidth; if ((windowWidth < 767 && !sortedReverse) || (windowWidth >= 767 && sortedReverse)) { var rtlContainer = $('.entry-content-wrapper'); rtlContainer.each(function(){ var rtlCols = $(this).children('.flex_column'); $(this).append(rtlCols.get().reverse()); }); sortedReverse = !sortedReverse; } }, 100); }).trigger("resize"); })(jQuery); </script> <?php } if(is_rtl()) { add_action('wp_footer', 'rtl_columns_fix'); }
Cheers!
JosueAugust 17, 2014 at 6:57 pm #305456Josue,
Thank you so much. It works perfect. Literally you solved a serious problem with rtl capability of the them and suggest to send the solution to Kriesi to be included in the next version.
I noticed another problem in my contact form too. At the bottom of the page check boxes are still LTR although the texts are positions on the right side. Do you know how to fix that too?
Thanks,
AmirAugust 17, 2014 at 7:48 pm #305473Hey Amir!
Try adding this code to the Quick CSS:
#top .avia_ajax_form input[type="checkbox"] { float: right; }
Cheers!
JosueAugust 18, 2014 at 5:53 am #305567Josue,
َAwesome! I think using your answers together with Enfold rtl.css file, one can say Enfold supports RTL languages. You are definitely doing a great job in this forum.
Thanks for all of your help in the past days. Please let me know if I can be a help for you.
Amir
August 18, 2014 at 6:34 am #305577You are welcome Amir, you are definitely helping us with your reports :)
Regards,
Josue -
AuthorPosts
- The topic ‘Issues with translating to Farsi RTL Language’ is closed to new replies.