{"id":17053772,"url":"https://github.com/terrymooreii/jquery-i18n","last_synced_at":"2026-04-16T01:33:00.586Z","repository":{"id":140328491,"uuid":"11321986","full_name":"TerryMooreII/jquery-i18n","owner":"TerryMooreII","description":"jQuery plugin for text localization on the client side.","archived":false,"fork":false,"pushed_at":"2013-07-16T12:32:41.000Z","size":216,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-25T19:37:09.694Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/TerryMooreII.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}},"created_at":"2013-07-10T19:34:09.000Z","updated_at":"2013-12-19T13:41:06.000Z","dependencies_parsed_at":"2023-03-13T10:43:46.980Z","dependency_job_id":null,"html_url":"https://github.com/TerryMooreII/jquery-i18n","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TerryMooreII/jquery-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerryMooreII%2Fjquery-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerryMooreII%2Fjquery-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerryMooreII%2Fjquery-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerryMooreII%2Fjquery-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TerryMooreII","download_url":"https://codeload.github.com/TerryMooreII/jquery-i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerryMooreII%2Fjquery-i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31867710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-14T10:13:11.112Z","updated_at":"2026-04-16T01:33:00.556Z","avatar_url":"https://github.com/TerryMooreII.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"jQuery-i18n Plug-in\n==================\n\nThe jquery-i18n plug-in is responsible for loading a translation dictionary file, parsing the DOM looking for a `data-i18n` attribute, and then updating the text with the translated value.\n\nWhether its with in a specific element selector or the entire body element the jQuery-i18n plug-in will load a translation file and find all children DOM elements that have a `data-i18n` attribute. Once an attribute is found its value will become the look up key in the translation file.  Depending on the element type it will then update the text value with the appropriate translation. \n\nAll translation files are loaded as needed and you do not have include translation dictionary in a the `script` tag in your HTML. This means we only load appropriately requested translation file which means less network requests.\n\nDemo\n----\n[Check out the demo](http://www.terrymooreii.com/localization)\n\n\n\nOptions\n-------\n\n**path:** _Default: i18n_\n```\nThe folder that contains the translations files\n```\n\n**baseFilename:** _Default: strings_\n```\nThe base file name for all translation files.\n```\n\n**language:** _Default: en_us_\n```\nThe language to use.\n```\n\n**missing:** \n```\nAn object that contains the default values that will be displayed if we are not able to locate the `data-i18n` key in the translation file.\n{\n\ttitle: '', // For A tags\n\talt: '', //For IMG tags\n\tplaceholder: '', //For INPUT/TEXTAREA tags\n\ttext: '\u003cmissing\u003e' // For SPAN, DIV, LABEL, P, etc tags\n}\n```\n\nThe language file used is a concatenation of the path, baseFilename, and the language. \n\n\n\nExamples \n--------\n\nWith the default setting, the application will load and use this translation file: i18n/strings_en_us.js.\n```javascript\n$('body').i18n();\n```\n\nIf you were to pass the language as ja_jp, the plug-in would then load and use the values from this file i18n/strings_ja_jp.js.\n```javascript\n$('body').i18n( { language : 'ja_jp' } );\n```\n\n**Sample HTML**\n```\n\u003chtml\u003e\n\u003cbody\u003e\n    \u003cdiv id=\"myId\"\u003e\n    \t\u003cspan data-i18n=\"welcome\"\u003e\u003c/span\u003e \u003c!-- Updates the span text with the welcome value from the translation file--\u003e\n        \u003cinput data-i18n=\"enter_name\"\u003e \u003c!-- Updates the placeholder value with enter_name value fro from the translation file--\u003e\n\t\u003c/div\u003e\n\t\u003cscript src=\"path/to/jquery\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"path/to/jquery.i18n.js\"\u003e\u003c/script\u003e\n\t\u003cscript\u003e\n\t\t$('body').i18n();\n\t\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nYou can even specify the div id `myId` instead of `body` to narrow down DOM parsing.  You can even call the i18n plug-in on multiple elements to have each of the element translated into different languages. \n\n\nTranslation file format\n-----------------------\n\nThe file must be in the following format. \nHere we are showing a strings file that ends in `en_us`. The ending to the file must match the object name in the translation file.\n\n```javascript\nwindow.i18n.en_us = {\n\twelcome: 'Welcome in English', \n\tenter_name: 'Enter Name'\n}\n```\n\n**Note:** The language value doesn't have to be a language_country format, you could specify and format that makes sense to your application as long as there is a file that exists in the path pattern above and it matches the window.i18n.`ending` format.\n\nMethods\n-------\n\n**getValue**\n\nWhen called on the same element that was used to instantiated the plug-in the return value of getValue will be the translated value in that language.\n\n```javascript\n$('body').i18n('getValue', 'welcome') //returns: Welcome in English\n```\n```javascript\n$('body').i18n('getValue', 'doesntExist') //returns: undefined\n```\n\n**destroy**\n\nRemoves the translations.  Call this before reapplying new translations.\n\n```javascript\n$('body').i18n('destroy');\n```\n\nElements supported \n------------------\n\nBelow is a list of the HTML elements that are currently supported with the with the `data-i18n` attribute\n\n`A` \nUpdates the title attribute\n\n`IMG`\nUpdates the alt attribute\n\n`INPUT` or `TEXTAREA`\nUpdates the placeholder attribute\n\n`SPAN`, `DIV`, `P`, `LABEL`\nUpdates the text value of that element by doing a `$(el).text('new value');` \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrymooreii%2Fjquery-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterrymooreii%2Fjquery-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrymooreii%2Fjquery-i18n/lists"}