{"id":23400501,"url":"https://github.com/luckyforce/easylang","last_synced_at":"2025-08-24T18:35:18.239Z","repository":{"id":199237135,"uuid":"480944340","full_name":"LuckyForce/EasyLang","owner":"LuckyForce","description":"A lightweight JavaScript/TypeScript language library to easily scale and manage multilingual websites.","archived":false,"fork":false,"pushed_at":"2022-04-12T22:21:29.000Z","size":25,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T18:45:29.367Z","etag":null,"topics":["javascript","javascript-library","language","multilingual-websites","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LuckyForce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-04-12T19:22:53.000Z","updated_at":"2023-11-03T13:36:22.000Z","dependencies_parsed_at":"2023-12-12T00:15:11.774Z","dependency_job_id":null,"html_url":"https://github.com/LuckyForce/EasyLang","commit_stats":null,"previous_names":["luckyforce/easylang"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LuckyForce/EasyLang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuckyForce%2FEasyLang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuckyForce%2FEasyLang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuckyForce%2FEasyLang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuckyForce%2FEasyLang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuckyForce","download_url":"https://codeload.github.com/LuckyForce/EasyLang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuckyForce%2FEasyLang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271922570,"owners_count":24844227,"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-08-24T02:00:11.135Z","response_time":111,"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":["javascript","javascript-library","language","multilingual-websites","typescript","typescript-library"],"created_at":"2024-12-22T10:45:07.859Z","updated_at":"2025-08-24T18:35:18.217Z","avatar_url":"https://github.com/LuckyForce.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasyLang\nA lightweight JavaScript/TypeScript language library to easily scale and manage multilingual websites.\n\n## Setup\nAll you need is to copy the file \u003ca href=\"https://github.com/LuckyForce/EasyLang/blob/main/js/EasyLang.js\"\u003eEasyLang.js\u003c/a\u003e or \u003ca href=\"https://github.com/LuckyForce/EasyLang/blob/main/ts/EasyLang.ts\"\u003eEasyLang.ts\u003c/a\u003e to your project and import it.\n\nTypeScript:\n```ts\n//Import\nimport { EasyLang } from './EasyLang.ts';\n//Create Instance\nconst lang = new EasyLang();\n```\nJavaScript:\n```js\n//Import\nimport { EasyLang } from './EasyLang.js';\n//Create Instance\nconst lang = new EasyLang();\n```\n\nTo make EasyLang work, you need to provide a language file in form of JSON. You can edit the path to the file in the file EasyLang.js or EasyLang.ts by changing the path of the import. Change PATH_NAME to the path of your language file.\n\n```js\nimport json from 'PATH_NAME' assert {type: 'json'};\n```\n\nThe language file has to be build like the following:\n```json\n{\n    \"default\": \"en\",\n    \"HelloWorld\": {\n        \"en\": \"Hello World\",\n        \"de\": \"Hallo Welt\",\n        \"es\": \"Hola Mundo\"\n    }\n}\n```\nThe \"default\" key is the default language. This language will be used if no language or translation is provided. If the language is not available, the default language will be used. If the default language is not available and the other language is not available, it will return null.\n\nPhrases can be defined in the following way:\n```json\n{\n    \"HelloWorld\": {\n        \"en\": \"Hello World\",\n        \"de\": \"Hallo Welt\",\n        \"es\": \"Hola Mundo\"\n    }\n}\n```\n\"HelloWorld\" is the key of the phrase. The value is an object with the languages as keys and the translation as value. If the phrase is not defined in the language file, it will return null.\n\n## Usage\nTo now use EasyLang you just need to call the method get() with the key of the phrase and the language.\n\nExample with the following language file:\n```json\n{\n    \"default\": \"en\",\n    \"HelloWorld\": {\n        \"en\": \"Hello World\",\n        \"de\": \"Hallo Welt\",\n        \"es\": \"Hola Mundo\"\n    }\n}\n```\n\n```js\n//Import\nimport { EasyLang } from './EasyLang.js';\n//Create Instance\nconst lang = new EasyLang();\n//Get Phrase\nlang.get('HelloWorld', 'en'); // Hello World\nlang.get('HelloWorld', 'de'); // Hallo Welt\nlang.get('HelloWorld', 'es'); // Hola Mundo\nlang.get('HelloWorld', 'fr'); // Hello World (default language)\nlang.get('HelloWorld'); // Hello World (default language)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckyforce%2Feasylang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluckyforce%2Feasylang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckyforce%2Feasylang/lists"}