{"id":25195205,"url":"https://github.com/siongui/gopherjs-i18n","last_synced_at":"2025-04-04T15:21:22.705Z","repository":{"id":148223366,"uuid":"51261655","full_name":"siongui/gopherjs-i18n","owner":"siongui","description":"i18n support in GopherJS","archived":false,"fork":false,"pushed_at":"2020-08-06T19:45:45.000Z","size":255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T00:51:12.483Z","etag":null,"topics":["frontend","gettext","go","gopherjs","i18n","locale","localization"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siongui.png","metadata":{"files":{"readme":"README.rst","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":"2016-02-07T19:19:30.000Z","updated_at":"2020-08-06T19:43:57.000Z","dependencies_parsed_at":"2023-05-03T05:32:26.355Z","dependency_job_id":null,"html_url":"https://github.com/siongui/gopherjs-i18n","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/siongui%2Fgopherjs-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siongui%2Fgopherjs-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siongui%2Fgopherjs-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siongui%2Fgopherjs-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siongui","download_url":"https://codeload.github.com/siongui/gopherjs-i18n/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198421,"owners_count":20900084,"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":["frontend","gettext","go","gopherjs","i18n","locale","localization"],"created_at":"2025-02-10T00:50:45.226Z","updated_at":"2025-04-04T15:21:22.698Z","avatar_url":"https://github.com/siongui.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"===============\nGopherJS_ i18n_\n===============\n\n.. image:: https://img.shields.io/badge/Language-Go-blue.svg\n   :target: https://golang.org/\n\n.. image:: https://godoc.org/github.com/siongui/gopherjs-i18n?status.svg\n   :target: https://godoc.org/github.com/siongui/gopherjs-i18n\n\n.. image:: https://travis-ci.org/siongui/gopherjs-i18n.svg?branch=master\n    :target: https://travis-ci.org/siongui/gopherjs-i18n\n\n.. .. image:: https://gitlab.com/siongui/gopherjs-i18n/badges/master/pipeline.svg\n    :target: https://gitlab.com/siongui/gopherjs-i18n/-/commits/master\n\n.. image:: https://goreportcard.com/badge/github.com/siongui/gopherjs-i18n\n   :target: https://goreportcard.com/report/github.com/siongui/gopherjs-i18n\n\n.. image:: https://img.shields.io/badge/license-Unlicense-blue.svg\n   :target: https://github.com/siongui/gopherjs-i18n/blob/master/UNLICENSE\n\n\n`gettext function`_ in your browser.\n\nThis package includes offline code to convert PO_ to JSON_,\nand runtime code to translate strings.\n\nDevelopment Environment:\n\n  - `Ubuntu 20.04`_\n  - `Go 1.12.17`_\n  - GopherJS_\n\n\nInstall\n+++++++\n\nInstall package:\n\n.. code-block:: bash\n\n  go get -u github.com/siongui/gopherjs-i18n\n\n\nOnline Translating Website\n++++++++++++++++++++++++++\n\nSee demo_ first. Demo code is in `example directory \u003cexample/\u003e`_.\n\nWrap the string you want to translate in element with *data-default-string*\nattribute containing the un-translated string. For example,\n\n.. code-block:: html\n\n  \u003cdiv data-default-string=\"Home\"\u003eHome\u003c/div\u003e\n\nor\n\n.. code-block:: html\n\n  \u003cspan data-default-string=\"Home\"\u003eHome\u003c/span\u003e\n\nBoth are valid for later translation.\n\n\nOffline Preparing Translation Data\n++++++++++++++++++++++++++++++++++\n\noffline: example for converting PO_ to JSON_:\n\n.. code-block:: go\n\n  package main\n\n  import \"github.com/siongui/gopherjs-i18n/tool\"\n\n  func main() {\n          po2json.PO2JSON(\"messages\", \"../pali/common/locale/\", \"po.json\")\n  }\n\n*PO2JSON* takes three arguments:\n\n  - *domain*: usually **messages**\n\n  - *localedir*: the directory where you put PO_ files\n\n  - *jsonPath*: output path of JSON_ file\n\n\nUNLICENSE\n+++++++++\n\nReleased in public domain. See UNLICENSE_.\n\n\nReferences\n++++++++++\n\n.. [1] `[Golang] gettext Function on Frontend (Browser) by GopherJS \u003chttps://siongui.github.io/2016/01/28/go-gettext-function-frontend-browser-by-gopherjs/\u003e`_\n\n.. [2] `[Golang] GopherJS Synonyms with JavaScript \u003chttps://siongui.github.io/2016/01/29/go-gopherjs-synonyms-with-javascript/\u003e`_\n\n.. [3] `golang list file in directory \u003chttps://www.google.com/search?q=golang+list+file+in+directory\u003e`_\n\n       `ReadDir - ioutil - The Go Programming Language \u003chttps://golang.org/pkg/io/ioutil/#ReadDir\u003e`_\n\n.. [4] `golang path join \u003chttps://www.google.com/search?q=golang+path+join\u003e`_\n\n       `path - The Go Programming Language \u003chttps://golang.org/pkg/path/\u003e`_\n\n\n.. _GopherJS: https://github.com/gopherjs/gopherjs\n.. _i18n: https://www.google.com/search?q=i18n\n.. _gettext function: http://linux.die.net/man/3/gettext\n.. _PO: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html\n.. _JSON: http://www.json.org/\n.. _Ubuntu 20.04: https://releases.ubuntu.com/20.04/\n.. _Go 1.12.17: https://golang.org/dl/\n.. _demo: https://siongui.github.io/gopherjs-i18n/\n.. _UNLICENSE: https://unlicense.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiongui%2Fgopherjs-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiongui%2Fgopherjs-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiongui%2Fgopherjs-i18n/lists"}