Skip to content

Commit

Permalink
Update language-functions.php
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukister committed May 3, 2023
1 parent 56ab383 commit fcade39
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions includes/language-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ function bogo_languages() {
return apply_filters( 'bogo_languages', $languages );
}


/**
* Returns the language name corresponding to the specified locale code.
*
* @param string $locale Locale code.
*/
function bogo_get_language( $locale ) {
$languages = bogo_languages();

Expand All @@ -166,6 +172,14 @@ function bogo_get_language( $locale ) {
return apply_filters( 'bogo_get_language', $language, $locale );
}


/**
* Returns the language native name corresponding to the specified locale code.
*
* @link http://api.wordpress.org/translations/core/1.0/
*
* @param string $locale Locale code.
*/
function bogo_get_language_native_name( $locale ) {
$native_names = array(
'af' => 'Afrikaans',
Expand Down Expand Up @@ -312,6 +326,15 @@ function bogo_get_language_native_name( $locale ) {
);
}


/**
* Returns the ISO 3166-1 alpha-2 country code corresponding to
* the specified locale code.
*
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
*
* @param string $locale Locale code.
*/
function bogo_get_country_code( $locale ) {
$special_cases = array(
'am' => 'ET', // Amharic => Ethiopia
Expand Down

0 comments on commit fcade39

Please sign in to comment.