Permalink
Browse files

Updated README file. Started the skeleton of the backend.

  • Loading branch information...
invalid-email-address committed Feb 9, 2010
1 parent 1e3740a commit 2888190da5a42979246c326ae60ba87283265b2c
Showing with 157 additions and 41 deletions.
  1. +8 −4 I18n.php
  2. +0 −35 README
  3. +37 −0 README.md
  4. +100 −0 lib/backend/base.php
  5. +8 −2 test/i18n_test.php
  6. +4 −0 test/test_data/locales/en.yml
View
@@ -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)
@@ -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())
View
35 README
@@ -1,35 +0,0 @@
-# PHP ActiveRecord #
-
-by Tom Rochette
-<roctom@gmail.com>
-<http://www.tomrochette.com>
-
-## Introduction ##
-A brief summarization of what I18n is:
-
-> Active record is an approach to access data in a database. A database table or view is wrapped into a class,
-> thus an object instance is tied to a single row in the table. After creation of an object, a new row is added to
-> the table upon save. Any object loaded gets its information from the database; when an object is updated, the
-> corresponding row in the table is also updated. The wrapper class implements accessor methods or properties for
-> each column in the table or view.
-
-More details can be found [here](http://en.wikipedia.org/wiki/Active_record_pattern).
-
-This implementation is inspired and thus borrows heavily from Ruby on Rails' ActiveRecord.
-We have tried to maintain their conventions while deviating mainly because of convenience or necessity.
-Of course, there are some differences which will be obvious to the user if they are familiar with rails.
-
-## Minimum Requirements ##
-
-PHP 5.3+
-
-## Installation ##
-
-Setup is very easy and straight-forward. Essentially, you have to point to the locales folder, and that's pretty much it.
-
-
-## Features ##
-
-- Internationalization similar to I18n found in Ruby on Rails I18n.
-
-## Usage ##
View
@@ -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 ##
View
@@ -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())
+ {
+
+ }
+}
+
+?>
View
@@ -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
}
}
@@ -0,0 +1,4 @@
+en:
+ foo:
+ bar: baz
+

0 comments on commit 2888190

Please sign in to comment.