Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fizker/php-l10n


https://github.com/fizker/php-l10n

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

Language Loader
===============

The purpose of this project is to deliver a simple, lazy-loading language
loader, which helps make localized php apps.

It is designed to be data-source agnostic, but a file-system based
implementation will be included.

All that is required of a sub-implementation is to override the loadTable
function, which will be called the first time a specific table is requested.

Working with the FileLanguageLoader
-----------------------------------

To see a live version, check the tests/integration folder, where it is used
in some integration tests.

The following code snippet shows how to use the library:

get('table', 'key');
?>

This will load the file `table.strings` from inside the `{root}/lang/pak/dir`
folder, and return the value for the key `key`.

The folder containing the language files should be a flat directory, where
each file has the extension `.strings` and is named after the table wanted.

[The file contents should follow the same syntax that Apple uses in Cocoa](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/macro/NSLocalizedStringFromTable).

Such a file might look like this:

"key" = "value";
"another key" = "another value";

Running the tests
-----------------

To run the unit tests, first run `install-tests`. Then simply running
`runTests.php` will execute the tests.