WordPress.org

Forums

How to get language name? (2 posts)

  1. mavenickster
    Member
    Posted 1 year ago #

    If I use get_bloginfo('language') I get it-IT as a result, but how can I get the name of the language, both in English and in local language?
    I mean:

    1. is there a function that given it-IT as input returns its local name ("Italiano")?
    2. is there a function that given it-IT as input returns its English name ("Italian")?

    Obvously the question is related to all languages.

  2. bcworkz
    Member
    Posted 1 year ago #

    If your PHP installation has the intl extension you can use Locale::getDisplayLanguage().

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags