1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 editing language codes

Discussion in 'Troubleshooting and Problems' started by rebelde, Sep 29, 2015.

  1. rebelde

    rebelde Member

    For generic Spanish, the language code shows as es-LA, for Latin American Spanish. This has two problems:
    1. My content is intended for Spain, too, not just Latin America.
    2. Google can't figure out the hreflang when it is set at "es" and lang="es-LA"

    What I want it to show is simply "es" in the header:
    Code:
    <html id="XenForo" lang="es"
    <html id="XenForo" lang="{$visitorLanguage.language_code}"
    I tried editing the xf_language table and then changing something about the language to get it to clear the cache and start using "es", but it just clears the entry.

    How can I edit the language code to just show the language without the country code?

    Thanks
     
  2. Mike

    Mike XenForo Developer Staff Member

    If choosing a specific "dialect" isn't an option (though I presume your translation would likely be using a particular one, like the default XF uses US English), you'd have to edit the PAGE_CONTAINER template to change that.
     
  3. rebelde

    rebelde Member

    I've got multiple languages on my forums, but I guess I can do if ... then statements. Thanks

    In general though, I think XF would be better off by allowing people to choose something as simple as "es", "fr" or "de" if they want to reach ALL Spanish, French and German users, instead of just those in specific countries. The fix would be easy enough.

    Edit: I see XF's own forums say en-US. Are you not interested in getting more visitors from the UK? ;)

    Edit: in case anybody stumbles across this thread, here is how I edited PAGE_CONTAINER:
    Code:
    <html id="XenForo"
    <xen:if is="{$visitorLanguage.language_code} == 'en-US'">lang="en"
    <xen:elseif is="{$visitorLanguage.language_code} == 'es-LA'" />lang="es"
    <xen:elseif is="{$visitorLanguage.language_code} == 'fr-FR'" />lang="fr"
    <xen:elseif is="{$visitorLanguage.language_code} == 'it-IT'" />lang="it"
    <xen:elseif is="{$visitorLanguage.language_code} == 'de-DE'" />lang="de"
    <xen:elseif is="{$visitorLanguage.language_code} == 'nl-NL'" />lang="nl"
    <xen:elseif is="{$visitorLanguage.language_code} == 'pl-PL'" />lang="pl"
    <xen:elseif is="{$visitorLanguage.language_code} == 'tr-TR'" />lang="tr"
    <xen:elseif is="{$visitorLanguage.language_code} == 'pt-BR'" />lang="pt"
    <xen:elseif is="{$visitorLanguage.language_code} == 'ar-AR'" />lang="ar"
    <xen:elseif is="{$visitorLanguage.language_code} == 'ru-RU'" />lang="ru"
    <xen:else />lang="{$visitorLanguage.language_code}"
    </xen:if>
     
    Last edited: Sep 29, 2015
    od808 likes this.

Share This Page