{"id":16055806,"url":"https://github.com/varunsridharan/wp-localizer","last_synced_at":"2025-04-10T20:14:12.533Z","repository":{"id":52419852,"uuid":"183535526","full_name":"varunsridharan/wp-localizer","owner":"varunsridharan","description":"Simple \u0026 Usefull WP Localizer Library","archived":false,"fork":false,"pushed_at":"2021-04-29T19:35:50.000Z","size":114,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T17:55:15.671Z","etag":null,"topics":["vsp-libs","wordpress","wordpress-development","wordpress-js-helpers","wordpress-js-utilites","wordpress-localization","wordpress-plugin","wordpress-plugin-api","wordpress-plugin-library","wordpress-theme","wordpress-theme-library","wp-library"],"latest_commit_sha":null,"homepage":"https://varunsridharan.github.io/wp-localizer/","language":"PHP","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/varunsridharan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-26T01:35:07.000Z","updated_at":"2022-06-27T07:28:03.000Z","dependencies_parsed_at":"2022-08-17T21:30:10.557Z","dependency_job_id":null,"html_url":"https://github.com/varunsridharan/wp-localizer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Fwp-localizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Fwp-localizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Fwp-localizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Fwp-localizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varunsridharan","download_url":"https://codeload.github.com/varunsridharan/wp-localizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288362,"owners_count":21078903,"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":["vsp-libs","wordpress","wordpress-development","wordpress-js-helpers","wordpress-js-utilites","wordpress-localization","wordpress-plugin","wordpress-plugin-api","wordpress-plugin-library","wordpress-theme","wordpress-theme-library","wp-library"],"created_at":"2024-10-09T02:22:17.910Z","updated_at":"2025-04-10T20:14:12.510Z","avatar_url":"https://github.com/varunsridharan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP Localizer\nSimple \u0026 Useful WP Localizer Library For Plugins / Themes\n\n[![Latest Stable Version][latest-stable-version-img]][latest-stable-version-link]\n[![Latest Unstable Version][latest-Unstable-version-img]][latest-Unstable-version-link]\n[![Total Downloads][total-downloads-img]][total-downloads-link]\n[![WP][wpcs-img]][wpcs-link]\n[![License][license-img]][license-link]\n[![composer.lock available][composerlock-img]][composerlock-link]\n\n## Installation\nThe preferred way to install this extension is through [Composer][composer].\n\nTo install **WP_Localizer library**, simply:\n\n    $ composer require varunsridharan/wp-localizer\n\nThe previous command will only install the necessary files, if you prefer to **download the entire source code** you can use:\n\n    $ composer require varunsridharan/wp-localizer --prefer-source\n\nYou can also **clone the complete repository** with Git:\n\n    $ git clone https://github.com/varunsridharan/wp-localizer.git\n\nOr **install it manually**:\n\n[Download Localizer.php][downloadphp]:\n\n    $ wget https://raw.githubusercontent.com/varunsridharan/wp-localizer/master/src/Localizer.php\n\n\n## Options\n| Option Name | Value | Description |\n| --- | --- | --- |\n| `id` |  String | Unique ID it should be a **slug** |\n| `scripts` | Array |  An Array of script handles to check before localizing the data  |\n| `frontend` | true / false |  Load in frontend ? ( By default it loads only in wp-admin )\n| `functions` | true / false |  Create useful JS Functions for getting values that are localized\n\n### Javascript Functions\nif **functions** arg is set to true then 2 javascript functions are generated\n* `{id}_option` -- Function to get arguments passed from php Eg : (`myplugin_option('object2'')`);\n* `{id}_txt` -- Function to get translated string passed from php Eg : (`myplugin_txt('some_title','Default Title'));\n\n## Usage\n\n```php\n\u003c?php\n/**\n * Create A New Instance\n */\n$instance = \\Varunsridharan\\WordPress\\Localizer::instance( array(\n    'id'        =\u003e 'myplugin',\n    'scripts'   =\u003e array( 'my-plugin-script' ),\n    'frontend'  =\u003e true,\n    'functions' =\u003e true,\n) );\n\n/**\n * Get Existing Instance\n */\n$instance_existing = \\Varunsridharan\\WordPress\\Localizer::instance( 'myplugin' );\n\n$instance-\u003eadd( 'alert_info', array(\n    'show' =\u003e false # It can be Array / String / Bool / Int\n) );\n\n$instance-\u003eadd( 'object2', 'Some Value'/* It can be Array / String / Bool / Int */ );\n\n/**\n * Merges With Existing object1 value.\n */\n$instance-\u003eadd( 'alet_info', array(\n\t'title' =\u003e 'Some Value',\n), true );\n\n// Translation.\n$instance-\u003etext('alert_title',__('Your Alert Title'));\n\n```\n### Javascript Usage\n```javascript\nvar $arg = myplugin_option( 'alert_info' );\nif(true === $arg.show){\n\talert($arg.title);\n}\nalert(myplugin_txt('alert_title','Default Title Here'));\n```\n\n\u003e ⚠️ **Note** `myplugin_option` AND `myplugin_txt` javascript functions are created dynamically \n\n\n---\n\n\u003c!-- START common-footer.mustache  --\u003e\n## 📝 Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n[Checkout CHANGELOG.md](https://github.com/varunsridharan/wp-localizer/blob/main/CHANGELOG.md)\n\n\n## 🤝 Contributing\nIf you would like to help, please take a look at the list of [issues](https://github.com/varunsridharan/wp-localizer/issues/).\n\n\n## 📜  License \u0026 Conduct\n- [**GNU General Public License v3.0**](https://github.com/varunsridharan/wp-localizer/blob/main/LICENSE) © [Varun Sridharan](website)\n- [Code of Conduct](https://github.com/varunsridharan/.github/blob/main/CODE_OF_CONDUCT.md)\n\n\n## 📣 Feedback\n- ⭐ This repository if this project helped you! :wink:\n- Create An [🔧 Issue](https://github.com/varunsridharan/wp-localizer/issues/) if you need help / found a bug\n\n\n## 💰 Sponsor\n[I][twitter] fell in love with open-source in 2013 and there has been no looking back since! You can read more about me [here][website].\nIf you, or your company, use any of my projects or like what I’m doing, kindly consider backing me. I'm in this for the long run.\n\n- ☕ How about we get to know each other over coffee? Buy me a cup for just [**$9.99**][buymeacoffee]\n- ☕️☕️ How about buying me just 2 cups of coffee each month? You can do that for as little as [**$9.99**][buymeacoffee]\n- 🔰         We love bettering open-source projects. Support 1-hour of open-source maintenance for [**$24.99 one-time?**][paypal]\n- 🚀         Love open-source tools? Me too! How about supporting one hour of open-source development for just [**$49.99 one-time ?**][paypal]\n\n\u003c!-- Personl Links --\u003e\n[paypal]: https://sva.onl/paypal\n[buymeacoffee]: https://sva.onl/buymeacoffee\n[twitter]: https://sva.onl/twitter/\n[website]: https://sva.onl/website/\n\n\n## Connect \u0026 Say 👋\n- **Follow** me on [👨‍💻 Github][github] and stay updated on free and open-source software\n- **Follow** me on [🐦 Twitter][twitter] to get updates on my latest open source projects\n- **Message** me on [📠 Telegram][telegram]\n- **Follow** my pet on [Instagram][sofythelabrador] for some _dog-tastic_ updates!\n\n\u003c!-- Personl Links --\u003e\n[sofythelabrador]: https://www.instagram.com/sofythelabrador/\n[github]: https://sva.onl/github/\n[twitter]: https://sva.onl/twitter/\n[telegram]: https://sva.onl/telegram/\n\n\n---\n\n\u003cp align=\"center\"\u003e\n\u003ci\u003eBuilt With ♥ By \u003ca href=\"https://sva.onl/twitter\"  target=\"_blank\" rel=\"noopener noreferrer\"\u003eVarun Sridharan\u003c/a\u003e \u003ca href=\"https://en.wikipedia.org/wiki/India\"\u003e\n   \u003cimg src=\"https://cdn.svarun.dev/flag-india.jpg\" width=\"20px\"/\u003e\u003c/a\u003e \u003c/i\u003e \u003cbr/\u003e\u003cbr/\u003e\n   \u003cimg src=\"https://cdn.svarun.dev/codeispoetry.png\"/\u003e\n\u003c/p\u003e\n\n---\n\n\n\u003c!-- END common-footer.mustache  --\u003e\n\n\n[composer]: http://getcomposer.org/download/\n[downloadphp]:https://raw.githubusercontent.com/varunsridharan/wp-localizer/master/src/Localizer.php\n\n\n[latest-stable-version-img]: https://poser.pugx.org/varunsridharan/wp-localizer/version\n[latest-Unstable-version-img]: https://poser.pugx.org/varunsridharan/wp-localizer/v/unstable\n[total-downloads-img]: https://poser.pugx.org/varunsridharan/wp-localizer/downloads\n[Latest-Unstable-version-img]: https://poser.pugx.org/varunsridharan/wp-localizer/v/unstable\n[wpcs-img]: https://img.shields.io/badge/WordPress-Standar-1abc9c.svg\n[license-img]: https://poser.pugx.org/varunsridharan/wp-localizer/license\n[composerlock-img]: https://poser.pugx.org/varunsridharan/wp-localizer/composerlock\n\n[latest-stable-version-link]: https://packagist.org/packages/varunsridharan/wp-localizer\n[latest-Unstable-version-link]: https://packagist.org/packages/varunsridharan/wp-localizer\n[total-downloads-link]: https://packagist.org/packages/varunsridharan/wp-localizer\n[Latest-Unstable-Version-link]: https://packagist.org/packages/varunsridharan/wp-localizer\n[wpcs-link]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/\n[license-link]: https://packagist.org/packages/varunsridharan/wp-localizer\n[composerlock-link]: https://packagist.org/packages/varunsridharan/wp-localizer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunsridharan%2Fwp-localizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarunsridharan%2Fwp-localizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunsridharan%2Fwp-localizer/lists"}