Skip to content

Commit

Permalink
Updated README file. Started the skeleton of the backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Feb 9, 2010
1 parent 1e3740a commit 2888190
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 41 deletions.
12 changes: 8 additions & 4 deletions I18n.php
Expand Up @@ -3,6 +3,10 @@
die('PHP I18n requires PHP 5.3 or higher');
}

require_once('SymfonyComponents/YAML/sfYaml.php');

$yaml = sfYaml::load('test/test_data/locales/en.yml');

spl_autoload_register('i18n_autoload');

function i18n_autoload($class_name)
Expand Down Expand Up @@ -85,10 +89,10 @@ public function set_load_path($load_path)

public function translate($args)
{
$options = ?;
$key = ?;
$locale = ?;
$raises
// $options = ?;
// $key = ?;
// $locale = ?;
// $raises
}

public function translate_exception($key, $options = array())
Expand Down
35 changes: 0 additions & 35 deletions README

This file was deleted.

37 changes: 37 additions & 0 deletions README.md
@@ -0,0 +1,37 @@
# PHP I18n #

by Tom Rochette
<roctom@gmail.com>
<http://www.tomrochette.com>

## Introduction ##
A brief summarization of what I18n is:

> In computing, internationalization and localization (also spelled internationalisation and localisation, see spelling differences)
> are means of adapting computer software to different languages and regional differences. Internationalization is the process of
> designing a software application so that it can be adapted to various languages and regions without engineering changes.
> Localization is the process of adapting internationalized software for a specific region or language by adding locale-specific
> components and translating text.
> Source : [Wikipedia](http://en.wikipedia.org/wiki/Internationalization_and_localization)
This implementation is inspired and thus borrows heavily from Ruby on Rails' I18n.
Ruby/Rails programming conventions have been maintained as much as possible. Deviation is due to language differences.

## Minimum Requirements ##

PHP 5.3+
Symfony PEAR Yaml Parser

## Installation ##

Setup is very easy and straight-forward. Essentially, you have to point to the locales folder, and that's pretty much it.

### Installing required PEAR package ###
pear channel-discover pear.symfony-project.com
pear install symfony/YAML

## Features ##

- Internationalization similar to I18n found in Ruby on Rails I18n.

## Usage ##
100 changes: 100 additions & 0 deletions lib/backend/base.php
@@ -0,0 +1,100 @@
<?php

namespace I18n\Backend;

class Base
{
private $initialized = false;

public function load_translations(array $filenames)
{

}

public function store_translations($locale, $data, $options = array())
{

}

public function translate($locale, $key, $options = array())
{

}

public function localize($locale, $object, $format = 'DEFAULT', $options = array())
{

}

public function is_initilized()
{
return $this->initialized;
}

public function available_locales()
{

}

public function reload()
{

}

public function lookup($locale, $key, $scope = array(), $options = array())
{

}

public function default($locale, $object, $subject, $options = array())
{

}

public function resolve($locale, $object, $subject, $options = null)
{

}

public function pluralize($locale, $entry, $count)
{

}

public function interpolate($locale, $string, $values = array())
{

}

public function preserve_encoding($string)
{

}

public function interpolate_lamba($object, $string, $key)
{

}

public function load_file($filename)
{

}

public function load_php($filename)
{

}

public function load_yml($filename)
{

}

public function merge_translations($locale, $data, $options = array())
{

}
}

?>
10 changes: 8 additions & 2 deletions test/i18n_test.php
Expand Up @@ -2,9 +2,15 @@

class I18n_test extends PHPUnit_Framework_TestCase
{
public function test_a()
public function setUp()
{
$this->fail();
parent::__construct();
// I18n::backend->store_translations('en');
}

public function test_uses_simple_backend_set_by_default()
{
// $this->assertTrue
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/test_data/locales/en.yml
@@ -0,0 +1,4 @@
en:
foo:
bar: baz

0 comments on commit 2888190

Please sign in to comment.