• Hello everyone, my site is biligual, using a solution I found here

    https://frenchfragfactory.net/ozh/archives/2004/05/11/a-solution-for-a-bilingual-wordpress/

    that was mentioned on another thread. If you click the upper right English and Japanese on my site, you’ll see that the language in the latest post will flip from one to the other.

    As you can see at https://www.japannewbie.com the font in the latest post, and the posts below, are different. This is what I want to fix.

    In order to make the posts bilingual, I have to use code like this when posting my entries.

    <div lang="en">ENGLISH TEXT</div>
    <div lang="jp">日本語 Japanese TEXT</div>

    I tried to force in P tags around the div tags to make it follow the regular style, but seems that after I save, it’s always revered back and my P tags have been removed…

    Any ideas on how I can implement this Bilingual DIV tag solution, while retaining my theme’s style?

    Any help appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • I tried to force in P tags around the div tags to make it follow the regular style, but seems that after I save, it’s always revered back and my P tags have been removed…

    That’s because it’s invalid XHTML. divs cannot reside within p(aragraph) tags. Have you tried placing the paragraph tags *within* the div tags?

    Another option would be to swap the div with p, and use:

    <p lang="en">ENGLISH TEXT</p>
    <p lang="jp">日本語 Japanese TEXT</p>

    Of course, this would require changes to Ozh’s javascript.

    Thread Starter Harvey

    (@harvey)

    Thanks for the tip Kafkaesqui, when putting the p(aragraph) tags within the div, they get removed out by WP as well. This system is smarter than me!

    Can I ask how I would need to modify the javascript to allow me to set the LANG with P instead of DIV?

    Thread Starter Harvey

    (@harvey)

    Is it possible to use the lang=”en” attribute AND the class=”??entrada??(in my case) attributes in the same DIV?

    First Q: In the javascript you *should* be able to change these various lines:

    document.getElementsByTagName("div")

    to:

    document.getElementsByTagName("p")

    Second Q: Yes, div (and p) tags accept both a lang and class attribute. I can’t say if they’d affect the javascript you’re using (not without being able to test it from here, that is).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Bilingual, div fonts getting mixed up’ is closed to new replies.