{"id":17846440,"url":"https://github.com/technicalguru/php-i18n","last_synced_at":"2026-06-22T19:32:08.939Z","repository":{"id":57066112,"uuid":"312200609","full_name":"technicalguru/php-i18n","owner":"technicalguru","description":"Provides localization features for PHP apps","archived":false,"fork":false,"pushed_at":"2022-10-30T10:02:18.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-01T17:27:09.997Z","etag":null,"topics":["i18n","internationalization","localization","php"],"latest_commit_sha":null,"homepage":"","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/technicalguru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-12T07:33:08.000Z","updated_at":"2021-06-12T14:05:11.000Z","dependencies_parsed_at":"2022-08-24T14:53:59.599Z","dependency_job_id":null,"html_url":"https://github.com/technicalguru/php-i18n","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/technicalguru/php-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicalguru%2Fphp-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicalguru%2Fphp-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicalguru%2Fphp-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicalguru%2Fphp-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/technicalguru","download_url":"https://codeload.github.com/technicalguru/php-i18n/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicalguru%2Fphp-i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34663524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"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":["i18n","internationalization","localization","php"],"created_at":"2024-10-27T21:39:57.157Z","updated_at":"2026-06-22T19:32:08.921Z","avatar_url":"https://github.com/technicalguru.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-i18n\nProvides localization features for PHP apps. It reads a local i18n file for your application\nand provides localized values for keys.\n\n# License\nThis project is licensed under [GNU LGPL 3.0](LICENSE.md). \n\n# Installation\n\n## By Composer\n\n```\ncomposer install technicalguru/i18n\n```\n\n## By Package Download\nYou can download the source code packages from [GitHub Release Page](https://github.com/technicalguru/php-i18n/releases)\n\n# How to use\n\n## Create a localization file\nCreate a file `i18n.php` somewhere where it can be accessed from your application.\n\n```\n\u003c?php\n\n/** Put here your language translations */\nreturn array(\n\t'welcome' =\u003e array(\n\t\t'de' =\u003e 'Willkommen!',\n\t\t'en' =\u003e 'Welcome!',\n\t),\n);\n```\n\n## Initialize I18N\n\nTell `I18N` where it will find your localizations and what your default language is.\n\n```\nuse TgI18n\\I18n;\n\nI18N::$i18nFile        = '/my/path/to/i18n.php';\nI18N::$defaultLangCode = 'de';\n```\n\n## Default Initialization\n\nYou don't need to tell `I18N` where to find your localizations when they exists in one\nof these places. The file needs to be named `i18n.php`.\n\n* Web Context Document Root as defined by `$_SERVER['CONTEXT_DOCUMENT_ROOT']`\n* Web Document Root as defined by `$_SERVER['DOCUMENT_ROOT']`\n* Current directory of your running script file (that is the one being executed)\n\nYou don't need to initialize the default language code, when it is `en`.\n\n## Translating Values\n\nNow you are setup to use your localizations:\n\n```\nuse TgI18n\\I18n;\n\necho I18N::_('welcome');\necho I18N::_('welcome', 'en');\necho I18N::_('welcome', 'de');\n```\n\nThe `_($key)` static method always returns a value. If the given key cannot be found then the\nkey itself will be returned. \n\nIf you prefer to have `NULL` returned, then use `__($key)`:\n\n```\nuse TgI18n\\I18n;\n\necho I18N::__('welcome');\necho I18N::__('welcome', 'en');\necho I18N::__('welcome', 'de');\n```\n\n# Contribution\nReport a bug, request an enhancement or pull request at the [GitHub Issue Tracker](https://github.com/technicalguru/php-i18n/issues).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnicalguru%2Fphp-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechnicalguru%2Fphp-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnicalguru%2Fphp-i18n/lists"}