{"id":16406334,"url":"https://github.com/alerque/fluent-lua","last_synced_at":"2025-10-10T11:35:15.114Z","repository":{"id":43271523,"uuid":"208005163","full_name":"alerque/fluent-lua","owner":"alerque","description":"Lua implementation of Project Fluent https://projectfluent.org","archived":false,"fork":false,"pushed_at":"2023-07-06T20:12:30.000Z","size":491,"stargazers_count":19,"open_issues_count":7,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-02T00:16:05.416Z","etag":null,"topics":["i18n","internationalization","l10n","localization","lua","luarocks"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alerque.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["alerque"]}},"created_at":"2019-09-12T08:47:39.000Z","updated_at":"2024-05-30T00:10:49.678Z","dependencies_parsed_at":"2024-05-30T00:10:44.710Z","dependency_job_id":"e92c8926-b07f-4a99-a355-9ba0e7cae01d","html_url":"https://github.com/alerque/fluent-lua","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/alerque/fluent-lua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerque%2Ffluent-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerque%2Ffluent-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerque%2Ffluent-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerque%2Ffluent-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alerque","download_url":"https://codeload.github.com/alerque/fluent-lua/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerque%2Ffluent-lua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003711,"owners_count":26083610,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["i18n","internationalization","l10n","localization","lua","luarocks"],"created_at":"2024-10-11T06:09:31.055Z","updated_at":"2025-10-10T11:35:15.076Z","avatar_url":"https://github.com/alerque.png","language":"Lua","readme":"# Fluent Lua¹\n\n[![Luacheck](https://github.com/alerque/fluent-lua/workflows/Luacheck/badge.svg)](https://github.com/alerque/fluent-lua/actions)\n[![Busted](https://github.com/alerque/fluent-lua/workflows/Busted/badge.svg)](https://github.com/alerque/fluent-lua/actions)\n[![Coverage Status](https://coveralls.io/repos/github/alerque/fluent-lua/badge.svg?branch=master)](https://coveralls.io/github/alerque/fluent-lua?branch=master)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/alerque/fluent-lua)](https://github.com/alerque/fluent-lua/releases)\n[![LuaRocks](https://img.shields.io/luarocks/v/alerque/fluent)](https://luarocks.org/modules/alerque/fluent)\n[![Join the chat at https://gitter.im/fluent-lua/community](https://badges.gitter.im/fluent-lua/community.svg)](https://gitter.im/fluent-lua/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nA Lua implementation of [Project Fluent][projectfluent], a localization paradigm designed to unleash the entire expressive power of natural language translations. Fluent is a family of localization specifications, implementations and good practices developed by Mozilla who extracted parts of their 'l20n' solution (used in Firefox and other apps) into a re-usable specification. For more information also see the [Fluent Syntax Guide][syntaxguide], the [Discourse channel][discourse], [documentation wiki][wiki], and [playground][play].\n\nOther implementations already exist in [Rust][fluent-rs], [Javascript][fluent.js], [Python][python-fluent], [c#][fluent.net], [elm][elm-fluent], and [perl][perl-fluent]. See also [other implementations][others].\n\n¹ \u003csub\u003eFluent the localization paradigm, not to be confused with Fluent the [API interface concept][fluentinterface]!\u003c/sub\u003e\n\n## Status\n\nIt is possible to use this for simple string localization with basic parameter substitution but it is not feature complete nor is the API stable (see [Lua alternatives](#alternatives)). If you have ideas about how the Lua API should work or wish to contribute, please join the project chat and/or open [issues](https://github.com/alerque/fluent-lua/issues) for points of discussion.\n\n- [x] Parse FTL input strings\n- [x] Format Basic messages\n- [x] Format String and Number literals\n- [x] Substitute VariableReferences\n- [x] Handle Attributes\n- [x] Handle Variants using SelectExpressions\n- [x] Handle TermsReferences\n- [x] Handle MessageReferences\n- [ ] Setup Locale fallbacks in Bundle\n- [ ] Localize number formatting\n- [ ] Functions\n\n## Changelog\n\nPlease see [CHANGELOG.md](./CHANGELOG.md).\n\n## Usage\n\nLua code `demo.lua`:\n\n```lua\n-- Import and start a new instance\nlocal FluentBundle = require(\"fluent\")\nlocal bundle = FluentBundle()\n\n-- Load some messages (can be a string or table of strings)\nbundle:add_messages([[\nhello = Hello { $name }!\nfoo = bar\n    .attr = baz\n]])\n\n-- Access methods like other Fluent implementations\nprint(bundle:format(\"foo\"))\nprint(bundle:format(\"foo.attr\"))\nprint(bundle:format(\"hello\", { name = \"World\" }))\n\n-- Alternate idomatic Lua access methods\nprint(bundle[\"foo\"]) -- access property, implicit cast to string, cannot pass parammeters\nprint(\"Attr: \" .. bundle.foo.attr) -- access attributes as property, allow contatenation\nprint(bundle.hello({ name = \"World\" })) -- access as property is callable, parameters passed to format()\n```\n\nOutput of `lua demo.lua`:\n\n```txt\nbar\nbaz\nHello World!\nbar\nAttr: baz\nHello World!\n```\n\n## Alternative(s)\n\nFluent-lua is usage for many basic use-cases but it is not 100% feature complete. If you need something more mature (and don’t have the energy to contribute here), have a look at the `i18n.lua` project ([Github](https://github.com/kikito/i18n.lua) / [LuaRocks](https://luarocks.org/modules/kikito/i18n)). It implements many of the same features this project will, just without the interoperability with other Fluent based tools. The Lua API it provides is quite nice, but your localization data needs to be provided in Lua tables instead of FTL files. While Fluent has quite a few more tricks up its sleeve the *i18n* module already has working interpolation, pluralization, locale fallbacks, and more. And it works now, today.\n\nAnother even simpler solution is the Lua `say` module ([Github](https://github.com/Olivine-Labs/say) / [LuaRocks](https://luarocks.org/modules/olivine-labs/say)) from the makers of Busted. This is much closer to a flat one-to-one key value map, but with namespacing in such a way that it is useful for localization.\n\n## Design Goals\n\n This project's end goal is to provide an idiomatic Lua API implementing the [Fluent spec][fluent] that is fully compatible with other FTL based tooling. This will allow Lua projects to easily implement localized interfaces with natural sounding translations and take advantage of tools such as [Pontoon][pontoon].\n\n  [discourse]: https://discourse.mozilla.org/c/fluent\n  [elm-fluent]: https://github.com/elm-fluent/elm-fluent\n  [fluent-rs]: https://github.com/projectfluent/fluent-rs\n  [fluent.js]: https://github.com/projectfluent/fluent.js\n  [fluent.net]: https://github.com/blushingpenguin/Fluent.Net\n  [fluent]: https://github.com/projectfluent/fluent\n  [fluentinterface]: https://en.wikipedia.org/wiki/Fluent_interface\n  [others]: https://github.com/projectfluent/fluent#other-implementations\n  [perl-fluent]: https://github.com/alabamenhu/Fluent\n  [play]: https://projectfluent.org/play/\n  [pontoon]: https://github.com/mozilla/pontoon\n  [projectfluent]: https://projectfluent.org\n  [python-fluent]: https://github.com/projectfluent/python-fluent\n  [syntaxguide]: http://projectfluent.org/fluent/guide\n  [wiki]: https://github.com/projectfluent/fluent/wiki\n","funding_links":["https://github.com/sponsors/alerque"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falerque%2Ffluent-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falerque%2Ffluent-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falerque%2Ffluent-lua/lists"}