• ragulka

    (@ragulka)


    I have a multisite with 8 different languages.
    One of them is Estonian, which has the locale “et”.
    However, the country code for Estonia is actually “ee”.
    (The full locale for estonia is et_EE)

    The correct language flag for estonian would be ee.png, but currently it is showing the Ethiopian flag et.png

    I imagine there could be more cases like this for other countries/languages, so I guess the easiest solution would be to create some exceptions in the plugin code to handle these cases.

    Another possible solution would be if there was a way to configure the flag code per site. So if I was looking at the configuration on the estonian site, there could be a field for language code and I could insert the language code manually.

    https://www.ads-software.com/extend/plugins/multisite-language-switcher/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    The problem is that WordPress uses the language-code ‘et’ an not ‘et_EE’ for Estonian. I moved the flag ee.png to et.png in my repository. This is not the best solution but for now it is a workaround.

    In the next versions it should be possible to decide which image-file should be used and not just the directory, you’re right.

    Thread Starter ragulka

    (@ragulka)

    I think renaming the falg is not a good idea. I think it would be best if the plugin knows how to handle these edge cases.

    For example, since we know that ‘et’ shoudl always map to ‘ee’, we could do something like this:

    /**
         * Get flag url
         *
         * @param string $language
         * @param bool $plugin
         * @return string
         */
        public function get_flag_url( $language ) {
            $url = (
                !is_admin() && $this->has_value( 'image_url' ) ?
                $this->__get( 'image_url' ) :
                $this->get_url( 'flags' )
            );
            if ( 5 == strlen( $language ) )
                $language = strtolower( substr( $language, -2 ) );
            // Add exception for Estonian locale
            if ( $language == 'et' )
                $language = 'ee';
            return sprintf( '%s/%s.png', $url, $language );
        }

    Plugin Author Dennis Ploetner

    (@realloc)

    Yes I know this is not really cool but even your solution has it’s limitations. Maybe it’s better to have an array with all language codes to flags.

    Thread Starter ragulka

    (@ragulka)

    Yep, some kind of mapping array would work great. And I just realized it would have to be before we extract the susbtring from the locale, otherwise, it could cause issues.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Wrong language flag for Estonian language’ is closed to new replies.