Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Georgian (ka) localization #169

Merged
merged 4 commits into from
Dec 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ This package contains language files for the following languages:
- Estonian
- Finnish
- French
- Georgian
- German
- Greek
- Hebrew
Expand Down
54 changes: 54 additions & 0 deletions src/Lang/ka.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* Georgian Language.
*
* @author Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
* @version 1.0.0
*/

return array(

/*
|--------------------------------------------------------------------------
| Date Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the date library. Each line can
| have a singular and plural translation separated by a '|'.
|
*/

'ago' => ':time უკან',
'from_now' => ':time შემდეგ',
'after' => ':time შემდეგ',
'before' => ':time უკან',
'year' => ':count წლის',
'month' => ':count თვის',
'week' => ':count კვირის',
'day' => ':count დღის',
'hour' => ':count საათის',
'minute' => ':count წუთის',
'second' => ':count წამის',

'january' => 'იანვარი',
'february' => 'თებერვალი',
'march' => 'მარტი',
'april' => 'აპრილი',
'may' => 'მაისი',
'june' => 'ივნისი',
'july' => 'ივლისი',
'august' => 'აგვისტო',
'september' => 'სექტემბერი',
'october' => 'ოქტომბერი',
'november' => 'ნოემბერი',
'december' => 'დეკემბერი',

'monday' => 'ორშაბათი',
'tuesday' => 'სამშაბათი',
'wednesday' => 'ოთხშაბათი',
'thursday' => 'ხუთშაბათი',
'friday' => 'პარასკევი',
'saturday' => 'შაბათი',
'sunday' => 'კვირა',

);
88 changes: 88 additions & 0 deletions tests/TranslationKaTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

use Jenssegers\Date\Date;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Translator;

class TranslationKaTest extends PHPUnit_Framework_TestCase
{

public function setUp()
{
date_default_timezone_set('UTC');
Date::setLocale('ka');
}

public function testGetsAndSetsTranslator()
{
$translator = new Translator('ka');
$translator->addLoader('array', new ArrayLoader());
$this->assertNotEquals($translator, Date::getTranslator());

Date::setTranslator($translator);
$this->assertEquals($translator, Date::getTranslator());
}

public function testTimespanTranslated()
{
$date = new Date(1403619368);
$date = $date->sub('-100 days -3 hours -20 minutes');

$this->assertSame('3 თვის, 1 კვირის, 1 დღის, 3 საათის, 20 წუთის', $date->timespan(1403619368));
}

public function testCreateFromFormat()
{
$date = Date::createFromFormat('d F Y', '1 იანვარი 2015');
$this->assertSame('2015-01-01', $date->format('Y-m-d'));

$date = Date::createFromFormat('D d F Y', 'შაბათი 21 მარტი 2015');
$this->assertSame('2015-03-21', $date->format('Y-m-d'));
}

public function testAgoTranslated()
{
$date = Date::parse('-21 hours');
$this->assertSame('21 საათის უკან', $date->ago(Date::now()));

$date = Date::parse('-5 days');
$this->assertSame('5 დღის უკან', $date->ago(Date::now()));

$date = Date::parse('-3 weeks');
$this->assertSame('3 კვირის უკან', $date->ago(Date::now()));

$date = Date::parse('-6 months');
$this->assertSame('6 თვის უკან', $date->ago(Date::now()));

$date = Date::parse('-10 years');
$this->assertSame('10 წლის უკან', $date->ago(Date::now()));
}

public function testFormatDeclensions()
{
$date = new Date('10 march 2015');
$this->assertSame('მარტი 2015', $date->format('F Y'));

$date = new Date('10 march 2015');
$this->assertSame('10 მარტი 2015', $date->format('j F Y'));
}

public function testAfterTranslated()
{
$date = Date::parse('+21 hours');
$this->assertSame('21 საათის შემდეგ', $date->ago(Date::now()));

$date = Date::parse('+5 days');
$this->assertSame('5 დღის შემდეგ', $date->ago(Date::now()));

$date = Date::parse('+3 weeks');
$this->assertSame('3 კვირის შემდეგ', $date->ago(Date::now()));

$date = Date::parse('+6 months');
$this->assertSame('6 თვის შემდეგ', $date->ago(Date::now()));

$date = Date::parse('+10 years');
$this->assertSame('10 წლის შემდეგ', $date->ago(Date::now()));
}

}
6 changes: 3 additions & 3 deletions tests/TranslationTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

use Jenssegers\Date\Date;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Translator;

class TranslationTest extends PHPUnit_Framework_TestCase {
class TranslationTest extends PHPUnit_Framework_TestCase
{

public function setUp()
{
Expand Down Expand Up @@ -164,5 +165,4 @@ public function testFormatDeclensions()
$date = new Date('10 march 2015');
$this->assertSame('10 мартa 2015', $date->format('j F Y'));
}

}