{"id":22666894,"url":"https://github.com/piko-framework/i18n","last_synced_at":"2025-10-05T02:08:43.560Z","repository":{"id":61178710,"uuid":"545422394","full_name":"piko-framework/i18n","owner":"piko-framework","description":"A minimal internationalization component which can be used in a piko application or standalone.","archived":false,"fork":false,"pushed_at":"2022-11-13T21:43:15.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-14T05:24:38.577Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piko-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-04T10:44:44.000Z","updated_at":"2022-10-04T10:45:09.000Z","dependencies_parsed_at":"2022-10-12T05:28:22.486Z","dependency_job_id":null,"html_url":"https://github.com/piko-framework/i18n","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/piko-framework/i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piko-framework%2Fi18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piko-framework%2Fi18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piko-framework%2Fi18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piko-framework%2Fi18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piko-framework","download_url":"https://codeload.github.com/piko-framework/i18n/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piko-framework%2Fi18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278399690,"owners_count":25980332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T14:32:12.503Z","updated_at":"2025-10-05T02:08:43.542Z","avatar_url":"https://github.com/piko-framework.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Piko I18n\n\n[![build](https://github.com/piko-framework/i18n/actions/workflows/php.yml/badge.svg)](https://github.com/piko-framework/i18n/actions/workflows/php.yml)\n[![Coverage Status](https://coveralls.io/repos/github/piko-framework/i18n/badge.svg?branch=main)](https://coveralls.io/github/piko-framework/i18n?branch=main)\n\nA minimal internationalization component which can be used in a piko application or standalone.\n\n## Installation\n\nIt's recommended that you use Composer to install Piko I18n.\n\n```bash\ncomposer require piko/i18n\n```\n\n## Usage\n\nIn order to use the I18n component, translations have to be stored in PHP \nfiles that return a key-value pair array of translations. Keys are strings to translate \nand values are corresponding translated strings.\n\nExample of translation file *fr.php* :\n\n```php\nreturn [\n    'Translation test' =\u003e 'Test de traduction',\n    'Hello {name}' =\u003e 'Bonjour {name}',\n];\n```\n\nApplication structure example:\n\n```\nApp root\n  |__messages\n    |__fr.php\n  |__index.php\n```\n\n## Usage in a piko application\n\nindex.php :\n\n```php\nuse Piko\\Application;\nuse function Piko\\I18n\\__;\n\nrequire('vendor/autoload.php');\n\n$config = [\n    'basePath' =\u003e __DIR__,\n    'components' =\u003e [\n        'Piko\\I18n' =\u003e [\n            'translations' =\u003e [\n                'app' =\u003e '@app/messages',\n            ],\n            'language' =\u003e 'fr'\n        ],\n    ],\n];\n\n$app = new Application($config);\n\n$i18n = $app-\u003egetComponent('Piko\\I18n');\n\necho $i18n-\u003etranslate('app', 'Translation test') . '\u003cbr\u003e'; // Test de traduction\necho $i18n-\u003etranslate('app', 'Hello {name}', ['name' =\u003e 'John']) . '\u003cbr\u003e' ; // Bonjour John\n\n// Using the proxy function __() :\necho __('app', 'Translation test') . '\u003cbr\u003e'; // Test de traduction\necho __('app', 'Hello {name}', ['name' =\u003e 'John']) . '\u003cbr\u003e' ;  // Bonjour John\n```\n\n## Usage in a standalone script\n\n```php\nuse Piko\\I18n;\nuse function Piko\\I18n\\__;\n\nrequire('vendor/autoload.php');\n\n$i18n = new I18n(['app' =\u003e __DIR__ . '/messages'], 'fr');\n\necho $i18n-\u003etranslate('app', 'Translation test') . '\u003cbr\u003e';\necho $i18n-\u003etranslate('app', 'Hello {name}', ['name' =\u003e 'John']) . '\u003cbr\u003e' ;\n\n// Using the proxy function __() :\n\necho __('app', 'Translation test') . '\u003cbr\u003e';\necho __('app', 'Hello {name}', ['name' =\u003e 'John']) . '\u003cbr\u003e' ;\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiko-framework%2Fi18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiko-framework%2Fi18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiko-framework%2Fi18n/lists"}