The helperTwitterLanguage returns the language code for the twitter share button.
The problem is that this function is limited for a specific languages:
There are more languages supported for the twitter button.
I use he-IL as the language code but the button still in english instead hebrew.
In any case, this function isn't really necessary. Twitter automatically uses the first two chars as the language. So `data-lang="he-IL"` would still show it as hebrew, there is no real need to cut it into `data-lang="he"`. If the language isn't recognized by twitter, it automatically fallback to english.
The problem is that this function is limited for a specific languages:
PHP:
case 'en':
case 'fr':
case 'de':
case 'it':
case 'es':
case 'ko':
case 'ja':
return $lang;
I use he-IL as the language code but the button still in english instead hebrew.
In any case, this function isn't really necessary. Twitter automatically uses the first two chars as the language. So `data-lang="he-IL"` would still show it as hebrew, there is no real need to cut it into `data-lang="he"`. If the language isn't recognized by twitter, it automatically fallback to english.
Last edited: