{"id":17695836,"url":"https://github.com/nadako/hxlocalize","last_synced_at":"2026-01-08T08:07:03.735Z","repository":{"id":145326170,"uuid":"55020869","full_name":"nadako/hxlocalize","owner":"nadako","description":"Type-safe localization with Haxe (EXPERIMENT)","archived":false,"fork":false,"pushed_at":"2019-05-04T09:56:51.000Z","size":12,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-06T05:21:59.185Z","etag":null,"topics":["haxe","localization","macros"],"latest_commit_sha":null,"homepage":null,"language":"Haxe","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/nadako.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-30T00:51:09.000Z","updated_at":"2019-05-04T09:56:53.000Z","dependencies_parsed_at":"2023-04-25T17:47:01.060Z","dependency_job_id":null,"html_url":"https://github.com/nadako/hxlocalize","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/nadako%2Fhxlocalize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadako%2Fhxlocalize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadako%2Fhxlocalize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadako%2Fhxlocalize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nadako","download_url":"https://codeload.github.com/nadako/hxlocalize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246395590,"owners_count":20770243,"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":["haxe","localization","macros"],"created_at":"2024-10-24T14:07:08.804Z","updated_at":"2026-01-08T08:07:03.652Z","avatar_url":"https://github.com/nadako.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hxlocalize\n\n[![Build Status](https://travis-ci.org/nadako/hxlocalize.svg?branch=master)](https://travis-ci.org/nadako/hxlocalize)\n\nThis is my small experiment with implementing type-safe localization in Haxe using macros.\n\n\u003e The awesome @kevinresol developed a proper library based on this idea, so if you're looking for a complete solution, check out [turnwing](https://github.com/kevinresol/turnwing)!\n\nThe idea is pretty simple: you declare all possible messages as empty methods in a child class of a magic base-class, like this:\n\n```haxe\nclass MyLocale extends Locale {\n    function person():String;\n    function message(name:String, count:Int):String;\n}\n```\n\nThen create an instance of that class, passing translations map like this:\n\n```haxe\nvar locale = new MyLocale(new Catalog([\n    \"person\" =\u003e \"Dan\",\n    \"message\" =\u003e \"Hi, {name} ({count})!\" // `name` and `count` match argument names\n]));\n```\n\nThen just call defined methods and get translated strings:\n\n```haxe\ntrace(locale.message(locale.person(), 5)); // Hi, Dan (5)!\n```\n\nI think there are several benefits with this approach, such as:\n\n * you can't make a typo in your locale key, since it's a real method, known at compile-time\n * you get autocompletion and refactoring support for your locale keys\n * localized string interpolation arguments are well-defined and typed\n * it's easy to validate the translation data files from a macro using method definitions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadako%2Fhxlocalize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnadako%2Fhxlocalize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadako%2Fhxlocalize/lists"}