Permalink
Browse files

rename "Lang" to "Locale", as requested by gauthierm

  • Loading branch information...
cweiske committed Jun 4, 2012
1 parent b541328 commit a036f394afaef2ed23f372a8369774f1a036548e
View
@@ -212,13 +212,13 @@ protected function getTranslation($string)
*
* @return void
*/
- public function setTranslator(Date_HumanDiff_Lang $translator)
+ public function setTranslator(Date_HumanDiff_Locale $translator)
{
$this->translator = $translator;
}
/**
- * Set the language to use.
+ * Set the locale to use.
*
* Supported formats:
* - 2-letter ISO code ("de", "fr")
@@ -228,7 +228,7 @@ public function setTranslator(Date_HumanDiff_Lang $translator)
*
* @return boolean True if the translations could be loaded, false if not.
*/
- public function setLanguage($lang)
+ public function setLocale($lang)
{
if (strlen($lang) > 2) {
//split off encoding
@@ -239,15 +239,15 @@ public function setLanguage($lang)
$lang = $locale;
}
- $class = 'Date_HumanDiff_Lang_' . $lang;
+ $class = 'Date_HumanDiff_Locale_' . $lang;
$file = str_replace('_', '/', $class) . '.php';
if ($this->isIncludable($file)) {
include_once $file;
}
if (!class_exists($class)) {
if (strlen($lang) > 2) {
//try main language without country
- return $this->setLanguage(substr($lang, 0, 2));
+ return $this->setLocale(substr($lang, 0, 2));
}
return false;
}
@@ -1,6 +1,6 @@
<?php
-interface Date_HumanDiff_Lang
+interface Date_HumanDiff_Locale
{
/**
* Get the translation for the given string.
@@ -1,7 +1,7 @@
<?php
-require_once 'Date/HumanDiff/LangArray.php';
+require_once 'Date/HumanDiff/LocaleArray.php';
-class Date_HumanDiff_Lang_de extends Date_HumanDiff_LangArray
+class Date_HumanDiff_Locale_de extends Date_HumanDiff_LocaleArray
{
/**
* Translation array.
@@ -1,7 +1,7 @@
<?php
-require_once 'Date/HumanDiff/Lang.php';
+require_once 'Date/HumanDiff/Locale.php';
-abstract class Date_HumanDiff_LangArray implements Date_HumanDiff_Lang
+abstract class Date_HumanDiff_LocaleArray implements Date_HumanDiff_Locale
{
/**
* Get the translation for the given string.
@@ -97,27 +97,27 @@ public function testGetStringDateTime()
);
}
- public function testSetLanguageExisting()
+ public function testSetLocaleExisting()
{
- $this->assertTrue($this->dh->setLanguage('de'));
+ $this->assertTrue($this->dh->setLocale('de'));
$this->assertEquals('gerade eben', $this->dh->get(time()));
}
- public function testSetLanguageParentExisting()
+ public function testSetLocaleParentExisting()
{
- $this->assertTrue($this->dh->setLanguage('de_AT'));
+ $this->assertTrue($this->dh->setLocale('de_AT'));
$this->assertEquals('gerade eben', $this->dh->get(time()));
}
- public function testSetLanguageNotExisting()
+ public function testSetLocaleNotExisting()
{
- $this->assertFalse($this->dh->setLanguage('mg'));
+ $this->assertFalse($this->dh->setLocale('mg'));
$this->assertEquals('just now', $this->dh->get(time()));
}
- public function testSetLanguageInvalid()
+ public function testSetLocaleInvalid()
{
- $this->assertFalse($this->dh->setLanguage('/path/to/some/file.php'));
+ $this->assertFalse($this->dh->setLocale('/path/to/some/file.php'));
$this->assertEquals('just now', $this->dh->get(time()));
}

0 comments on commit a036f39

Please sign in to comment.