{"id":27977287,"url":"https://github.com/magicjar/magic-lang","last_synced_at":"2026-06-20T04:32:04.627Z","repository":{"id":118173205,"uuid":"275684072","full_name":"magicjar/magic-lang","owner":"magicjar","description":"Javascript multi-language switcher library.","archived":false,"fork":false,"pushed_at":"2020-08-03T20:03:53.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T11:36:12.738Z","etag":null,"topics":["javascript-library","language-switcher-plugin","multi-language","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicjar.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-28T23:10:30.000Z","updated_at":"2022-09-21T17:59:37.000Z","dependencies_parsed_at":"2023-04-22T11:38:33.255Z","dependency_job_id":null,"html_url":"https://github.com/magicjar/magic-lang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/magicjar/magic-lang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicjar%2Fmagic-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicjar%2Fmagic-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicjar%2Fmagic-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicjar%2Fmagic-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicjar","download_url":"https://codeload.github.com/magicjar/magic-lang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicjar%2Fmagic-lang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34557551,"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-20T02:00:06.407Z","response_time":98,"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-library","language-switcher-plugin","multi-language","typescript"],"created_at":"2025-05-08T01:48:04.726Z","updated_at":"2026-06-20T04:32:04.610Z","avatar_url":"https://github.com/magicjar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Magic-Lang\n\nJavascript multi-language switcher system\n\n## Quick links\n\n- [Getting started](#getting-started)\n- [Implementing](#implementing)\n   - [Prepare the language dictionary](#prepare-the-language-dictionary)\n   - [Prepare the site](#prepare-the-site)\n- [Options](#options)\n- [Browser support](#browser-support)\n- [License](#license)\n\n## Getting started\n\n1. Download from [Github](https://github.com/magicjar/magic-lang)\n\n2. Grab all files inside `dist` folder (`js` and `lang` folders) to your assets folder\n\n    - Include the script before the closing `\u003c/body\u003e` tag\n\n        ``` html\n        \u003cscript src=\"../js/magic-lang.min.js\"\u003e\u003c/script\u003e\n        ```\n\n## Implementing\n\n### Prepare the language dictionary\n\n1. Create new file named `en.json` and placed it inside the `lang` folder and open it.\n\n2. Add the following example\n    ``` json\n    {\n        \"title\": \"Translate this title!\",\n        \"...\": \"...\"\n    }\n    ```\n3. Create another language file, example `id.json` for Indonesian language\n\n4. Copy all content from `en.json` and just translate it inside `id.json`\n    ``` json\n    {\n        \"title\": \"Terjemahkan judul ini!\",\n        \"...\": \"...\"\n    }\n\n### Prepare the site\n\n1. Add `magiclang` attribute to element you want to translate\n    ``` html\n    \u003ch1 magiclang=\"title\"\u003eTranslate this title!\u003c/h1\u003e\n    ```\n\n2. Add options\n    ``` html\n    \u003cscript\u003e\n        MagicLang.option({\n            langList: ['en', 'id'], // Specify all of site language here\n            lang: 'en' // Default language\n        });\n    \u003c/script\u003e\n    ```\n\n3. Initiate Magic-lang\n    ``` html\n    \u003cscript\u003e\n        MagicLang.init();\n    \u003c/script\u003e\n    ```\n\n4. Change language\n\n    To change the language just add search parameter on the url \n    \n    Example: `https://yourawesomesite.com/?lang=en`\n\n## Options\n\nYou can change any default option with the following method.\n\n\nOption | Value (default) | Description\n------ | --------------- | -----------\n**langList** | ['en', 'id'] **(mandatory)**' | You have to specify all of your site language\n**path** | 'dist/lang' (optional) | Language files root directory\n**lang** | 'en' (optional) | The default site language\n**attr** | 'magiclang' (optional) | Attribute name to indicate which element should be translated\n**urlParam** | 'lang' | Search parameter name\n\n## Browser support\n\nMagic-Lang currently only support all browser that support `ES6` syntax.\n\nKnown **supported** browser:\n- Edge \u003e= 12\n- Firefox \u003e= 34\n- Chrome \u003e= 45\n- Safari \u003e= 9\n- Opera \u003e= 32\n- Android webview \u003e= 45\n- Chrome for Android \u003e= 45\n- Firefox for Android \u003e= 34\n- Opera for Android \u003e= 32\n- Safari on iOS \u003e= 9\n- Samsung Internet \u003e= 5\n\n## License\n\nMagic-Lang released under the [MIT License](https://github.com/magicjar/magic-lang/blob/master/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicjar%2Fmagic-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicjar%2Fmagic-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicjar%2Fmagic-lang/lists"}