{"id":21260732,"url":"https://github.com/erf/lang","last_synced_at":"2026-01-02T22:14:40.763Z","repository":{"id":69768468,"uuid":"321480332","full_name":"erf/lang","owner":"erf","description":"Tiny language translation lib for Javascript","archived":false,"fork":false,"pushed_at":"2020-12-20T15:17:25.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T02:50:30.479Z","etag":null,"topics":["javascript-library","lang","language","localization","translation"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-14T21:44:12.000Z","updated_at":"2020-12-20T15:17:27.000Z","dependencies_parsed_at":"2023-05-10T19:30:50.587Z","dependency_job_id":null,"html_url":"https://github.com/erf/lang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Flang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Flang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Flang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Flang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erf","download_url":"https://codeload.github.com/erf/lang/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695537,"owners_count":20332626,"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","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":["javascript-library","lang","language","localization","translation"],"created_at":"2024-11-21T04:20:26.480Z","updated_at":"2026-01-02T22:14:40.720Z","avatar_url":"https://github.com/erf.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lang\n\nTiny language translation lib for Javascript\n\n## API\n\n`lang` - initialize given a translation object - returns API.\n\n`tr` - get translation given a tag with optional parameters.\n\n`setLang` - set the current language given language code.\n\n\n## Example\n\nInitialize using `lang` given a translation object.\n\n```Javascript\nlang(translation)\n```\n\nUse `setLang` to change language and `tr` to get translation.\n\n```Javascript\n// set langauge given code\nsetLang('en')\n\n// get translation given a tag and current code\ntr('car')\n\n// get translation given a tag and additional parameter\ntr('hi', 'Erlend')\n```\n\nSee [example.html](example.html)\n\n\n## Translation format\n\nWe initialize using `lang` with a `translation` object, given language codes as keys and a `tag` per translation.\n\nYou can add parameters to your translations using `{}`.\n\n```Javascript\n    const translations = {\n        'en': {\n            'car': 'car',\n            'hi': 'Hi {}, how are you doing?',\n        },\n        'nb': {\n            'car': 'bil',\n            'hi': 'Hei {}, hvordan går det?',\n        },\n    }\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferf%2Flang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferf%2Flang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferf%2Flang/lists"}