{"id":32163429,"url":"https://github.com/chrbauer/gettext-th","last_synced_at":"2026-02-20T00:31:46.191Z","repository":{"id":57749957,"uuid":"522191208","full_name":"chrbauer/gettext-th","owner":"chrbauer","description":"compile time localization of haskell programs","archived":false,"fork":false,"pushed_at":"2022-12-31T11:26:03.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-08T01:13:47.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","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/chrbauer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-08-07T11:15:21.000Z","updated_at":"2022-08-07T11:15:42.000Z","dependencies_parsed_at":"2023-01-31T19:01:49.038Z","dependency_job_id":null,"html_url":"https://github.com/chrbauer/gettext-th","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chrbauer/gettext-th","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrbauer%2Fgettext-th","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrbauer%2Fgettext-th/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrbauer%2Fgettext-th/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrbauer%2Fgettext-th/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrbauer","download_url":"https://codeload.github.com/chrbauer/gettext-th/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrbauer%2Fgettext-th/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29637408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T22:32:43.237Z","status":"ssl_error","status_checked_at":"2026-02-19T22:32:38.330Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2025-10-21T14:31:37.689Z","updated_at":"2026-02-20T00:31:46.186Z","avatar_url":"https://github.com/chrbauer.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gettext-th\n\nThe [gettext](https://www.gnu.org/software/gettext/) project provides a library and tools for internationalization and localization of software. Haskell has already support for gettext. It is possible either to use the C-library with FFI ([hgettext](https://hackage.haskell.org/package/hgettext)) or to use a pure Haskell implementation ([haskell-gettext](https://hackage.haskell.org/package/haskell-gettext-0.1.2.0)).\n\nWith gettext the executables and the translations are separated and the language strings are looked up at runtime. The [loadCatalog](https://hackage.haskell.org/package/haskell-gettext-0.1.2.0/docs/Data-Gettext.html) of gettext-haskell has to read the translations at runtime with IO.\n\nThis is difficult if you transpile your haskell code to javascript, which runs in a browser. To close this gap gettext-th moves the lookup of messages to compile time. A similar approach was taken for [angular-i18n](https://angular.io/guide/i18n-overview) for performance reasons.\nThis of course has some drawbacks (less flexible and one program per language) and some benefits (simple and performant).\n\nTheoretically gettext-th could also choose between runtime and compile time lookups.\n\n# Warning\n\ngettext-th will use IO at compile time and will write a file.\n\n# How to use it\n\nSee for an example in example/hello.\n\nTo use gettext-th in your app use it and compile it. It will fail, but it will create the file po/messages_\u003cfilename\u003e.pot.\nRun in the po folder:\n\n```sh\nmsginit\nmsgfmt en_US.po\n```\n\nWith that the program compiles. And you can update en_US.po again.\n\nNow copy en_US.po to de_DE.po, translate the messages and run `msgfmt de_DE.po`.\nIf you recompile (maybe run cabal clean first) the output of your app is in german.\n\nIf you have messages in multiple files, gettext-th writes for each of them a pot file. Use msgcat to merge them.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrbauer%2Fgettext-th","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrbauer%2Fgettext-th","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrbauer%2Fgettext-th/lists"}