• snippet24

    (@snippet24)


    I know there are plenty of plugins for translation, but it seems no one uses this approach, which is to use lang inline attributes like this:

    <!DOCTYPE html>
    <html>
    <body>
    <p lang="en">This is a paragraph.</p>
    <p lang="es">Esto es un parrafo.</p>
    <p lang="fr">Ceci est un paragraphe.</p>
    </body>
    </html>

    Further info: Maybe a plugin/Wordpress could implement cached page copies based on this attributes? I’m aware of multi sites, but I consider it way to complex to support since not all plugins have support for it for instance.

    • This topic was modified 6 years ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • ikaring

    (@ikaring)

    Hi.
    What is the purpose of this approach, translation or accessibility?

    Above example just display 3 paragraphs, I guess.

    Thread Starter snippet24

    (@snippet24)

    What is the purpose of this approach, translation or accessibility?

    Well I was considering as approach to translate, but maybe it could be both?

    Above example just display 3 paragraphs, I guess.

    Yes but maybe like the Autoptimize plugin, based in this approach a web page for each language could be generated with the appropriate html lang language.

    https://www.w3.org/International/questions/qa-html-language-declarations

    • This reply was modified 6 years ago by snippet24.
    • This reply was modified 6 years ago by snippet24.
    ikaring

    (@ikaring)

    It is ok if that suits you, but I dont think Im gonna use it.
    It sounds complicated for me to make/maintain lots of contents.

    Thread Starter snippet24

    (@snippet24)

    But would it be less complicated than using a multi site I wonder? or than creating different websites for each language? Do note that this may be for content not managed from within WordPress, meaning that for example the_content should be translated with an existing plugin, but for content that doesn’t change there’s no need to integrate it; is extra work.

    • This reply was modified 6 years ago by snippet24.
    • This reply was modified 6 years ago by snippet24.
    ikaring

    (@ikaring)

    Yes, there shoud be extra works and one page contents get too long.
    Furthermore, what about custom fields, tags, dates?

    Thread Starter snippet24

    (@snippet24)

    Maybe I poorly explained:

    shoud be extra work

    The extra work is for passing from hardcoded code to for exmaple the loop in WordPress for content that the user doesn’t need to modify/update

    Furthermore, what about custom fields, tags, dates?

    There are already plugins that do that.

    Thread Starter snippet24

    (@snippet24)

    Or maybe even better: to use lang atribute on a “span” tag inside the “p” tag for example. What are your thoughts on this?
    Should be like this:

    <!DOCTYPE html>
    <html>
    <body>
    <p>
    <span lang="en">This is a paragraph.</span>
    <span lang="es">Esto es un parrafo.</span>
    <span lang="fr">Ceci est un paragraphe.</span>
    </p>
    </body>
    </html>
    • This reply was modified 6 years ago by snippet24.
    • This reply was modified 6 years ago by snippet24.
    Thread Starter snippet24

    (@snippet24)

    Well it happens this exists already https://github.com/Irrelon/jquery-lang-js
    I’m still checking it, but it also seems to support lang switching with ajax/no reloading of the page!!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Translation using lang html atributtes?’ is closed to new replies.