Skip to content

Commit

Permalink
Adding getLocale
Browse files Browse the repository at this point in the history
  • Loading branch information
spekary committed Jul 6, 2017
1 parent 549d5da commit 994cc1d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/GettextTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,14 @@ public function setLanguage ($strLanguage, $strCountry = null)
putenv("LANG=" . $locale); //ight need LANGUAGE setting too.
setlocale(LC_ALL, $locale);
}

/**
* Return the current locale setting.
*
* @return string
*/
public function getLocale()
{
return setlocale(LC_ALL, 0);
}
}
10 changes: 10 additions & 0 deletions src/SimpleCacheTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ public function setLanguage($strLanguage, $strCountry = null)
}
}

/**
* Returns the current locale as a string.
*
* @return string
*/
public function getLocale()
{
return $this->strLocale;
}

/**
* Translate the given message.
*
Expand Down
7 changes: 7 additions & 0 deletions src/TranslatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public function translatePlural($strMsgId, $strMsgId_plural, $intNum, $strDomain
*/
public function setLanguage ($strLanguage, $strCountry);

/**
* Return the current locale setting as a string.
*
* @return string
*/
public function getLocale();

/**
* Tell us where to find the translations for a particular directory. Some translators will support multiple
* charsets, and some only UTF-8.
Expand Down

0 comments on commit 994cc1d

Please sign in to comment.