{"id":29492728,"url":"https://github.com/zhuravkovigor/love-i18n","last_synced_at":"2026-05-15T22:02:22.401Z","repository":{"id":304601851,"uuid":"1018873652","full_name":"zhuravkovigor/love-i18n","owner":"zhuravkovigor","description":"love-i18n is a lightweight internationalization (i18n) library designed specifically for Love2D games but also works with regular Lua projects.","archived":false,"fork":false,"pushed_at":"2025-07-23T09:06:18.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-21T11:54:07.299Z","etag":null,"topics":["love2d","lua","lua-module","luarocks","makefile","types"],"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/zhuravkovigor.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-13T08:31:33.000Z","updated_at":"2025-07-23T09:06:22.000Z","dependencies_parsed_at":"2025-07-14T07:41:45.973Z","dependency_job_id":"8eeb5222-6698-4c77-b589-a04b1b1291c1","html_url":"https://github.com/zhuravkovigor/love-i18n","commit_stats":null,"previous_names":["zhuravkovigor/love-i18n"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zhuravkovigor/love-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuravkovigor%2Flove-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuravkovigor%2Flove-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuravkovigor%2Flove-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuravkovigor%2Flove-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhuravkovigor","download_url":"https://codeload.github.com/zhuravkovigor/love-i18n/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuravkovigor%2Flove-i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016918,"owners_count":26085887,"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-13T02:00:06.723Z","response_time":61,"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":["love2d","lua","lua-module","luarocks","makefile","types"],"created_at":"2025-07-15T16:00:55.799Z","updated_at":"2025-10-13T19:35:52.151Z","avatar_url":"https://github.com/zhuravkovigor.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# love-i18n\n\nlove-i18n is a powerful and fully-featured internationalization (i18n) library designed specifically for Love2D games, while also remaining compatible with general Lua projects.\n\n## Features\n\n- 🌍 **Automatic loading** of translation files from configurable directory\n- 🔑 **Nested keys support** using dot notation (e.g., `\"menu.items.play\"`)\n- 📝 **String interpolation** with placeholder support (`{placeholder}`)\n- 🔄 **Fallback language** support for missing translations\n- 💙 **Love2D integration** with filesystem support\n- ⚡ **Simple API** for adding translations dynamically\n- 📦 **LuaRocks compatible** for easy installation\n- 🔒 **Strongly typed** with comprehensive type annotations\n\n## Installation\n\n### Option 1: LuaRocks\n\n```bash\nluarocks install --local love-i18n\n```\n\n### Option 2: Git Clone\n\n```bash\ngit clone https://github.com/zhuravkovigor/love-i18n\n```\n\nThen copy `init.lua` to your project directory or add the cloned directory to your Lua path.\n\n### Option 3: Manual Installation\n\nDownload the `init.lua` file and place it in your project directory.\n\n## Quick Start\n\n```lua\nlocal i18n = require(\"love-i18n\") -- or require(\"init\") for manual installation\n\n-- Configure (optional - these are defaults)\ni18n.configure({\n  localesDir = \"locales\",\n  fallbackLocale = \"en\",\n  currentLocale = \"en\"\n})\n\n-- Load all translation files\ni18n.load()\n\n-- Use translations\nprint(i18n.t(\"welcome\"))                     -- \"Welcome to our game!\"\nprint(i18n.t(\"menu.title\"))                  -- \"Main Menu\"\nprint(i18n.t(\"game.score\", { score = 100 })) -- \"Score: 100\"\n\n-- Switch language\ni18n.setLocale(\"es\")\nprint(i18n.t(\"welcome\"))                     -- \"¡Bienvenido a nuestro juego!\"\n```\n\n## Translation Files\n\nCreate translation files in your `translations` directory (or custom directory):\n\n**translations/en.lua**\n\n```lua\nreturn {\n  welcome = \"Welcome to our game!\",\n  goodbye = \"Goodbye!\",\n\n  menu = {\n    title = \"Main Menu\",\n    items = {\n      play = \"Play\",\n      settings = \"Settings\",\n      exit = \"Exit\"\n    }\n  },\n\n  game = {\n    score = \"Score: {score}\",\n    level = \"Level {level}\",\n    lives = \"Lives: {lives}\"\n  }\n}\n```\n\n**translations/es.lua**\n\n```lua\nreturn {\n  welcome = \"¡Bienvenido a nuestro juego!\",\n  goodbye = \"¡Adiós!\",\n\n  menu = {\n    title = \"Menú Principal\",\n    items = {\n      play = \"Jugar\",\n      settings = \"Configuración\",\n      exit = \"Salir\"\n    }\n  },\n\n  game = {\n    score = \"Puntuación: {score}\",\n    level = \"Nivel {level}\",\n    lives = \"Vidas: {lives}\"\n  }\n}\n```\n\n## API Reference\n\n### Configuration\n\n#### `i18n.configure(options)`\n\nConfigure the library settings.\n\n```lua\ni18n.configure({\n  localesDir = \"locales\",     -- Directory containing translation files\n  fallbackLocale = \"en\",               -- Fallback language when translation not found\n  currentLocale = \"en\",                -- Current active language\n  interpolationPattern = \"{([^}]+)}\"   -- Pattern for placeholder interpolation\n})\n```\n\n### Loading Translations\n\n#### `i18n.load()`\n\nLoad all translation files from the translations directory.\n\n#### `i18n.loadFile(locale, filepath)`\n\nLoad a specific translation file.\n\n```lua\ni18n.loadFile(\"fr\", \"custom/french.lua\")\n```\n\n#### `i18n.set(locale, data)`\n\nSet translation data directly.\n\n```lua\ni18n.set(\"es\", {\n  welcome = \"¡Bienvenido!\",\n  goodbye = \"¡Adiós!\"\n})\n```\n\n### Translation\n\n#### `i18n.t(key, params, locale)` or `i18n.translate(key, params, locale)`\n\nTranslate a key with optional parameters and locale override.\n\n```lua\ni18n.t(\"welcome\")                           -- Basic translation\ni18n.t(\"menu.items.play\")                   -- Nested key\ni18n.t(\"game.score\", { score = 1500 })      -- With interpolation\ni18n.t(\"welcome\", nil, \"es\")                -- Force specific locale\n```\n\n### Locale Management\n\n#### `i18n.getLocale()`\n\nGet the current locale.\n\n#### `i18n.setLocale(locale)`\n\nSet the current locale.\n\n#### `i18n.getFallbackLocale()`\n\nGet the fallback locale.\n\n#### `i18n.setFallbackLocale(locale)`\n\nSet the fallback locale.\n\n#### `i18n.getLocales()`\n\nGet array of all available locales.\n\n#### `i18n.localeExists(locale)`\n\nCheck if a locale is available.\n\n### Dynamic Translations\n\n#### `i18n.add(locale, key, value)`\n\nAdd a translation key-value pair dynamically.\n\n```lua\ni18n.add(\"en\", \"dynamic.message\", \"This is dynamic!\")\ni18n.add(\"en\", \"nested.deep.key\", \"Deep nested value\")\n```\n\n## Love2D Integration\n\nThe library automatically detects Love2D and uses `love.filesystem` for file operations. Here's a simple integration example:\n\n```lua\nfunction love.load()\n  local i18n = require(\"love-i18n\")\n  i18n.load()\n  love.window.setTitle(i18n.t(\"game.title\"))\nend\n\nfunction love.draw()\n  love.graphics.print(i18n.t(\"game.score\", { score = player.score }), 10, 10)\nend\n\nfunction love.keypressed(key)\n  if key == \"l\" then\n    -- Switch language with 'L' key\n    local current = i18n.getLocale()\n    i18n.setLocale(current == \"en\" and \"es\" or \"en\")\n  end\nend\n```\n\n## Testing\n\nRun the test suite:\n\n```bash\nlua test.lua\n```\n\n## Development Setup\n\nThis project includes a complete VS Code development environment with configured tasks, debugging, and code formatting.\n\n### Prerequisites\n\n```bash\n# Install LuaRocks and development tools\nsudo apt install luarocks  # On Ubuntu/Debian\n# or\nbrew install luarocks      # On macOS\n\n# Install development dependencies\nluarocks install --local luacheck  # Code linting\nluarocks install --local ldoc      # Documentation generation\n```\n\n### VS Code Setup\n\n1. Install recommended extensions (VS Code will prompt automatically)\n2. The project includes pre-configured:\n   - **Tasks** for testing, linting, formatting, and publishing\n   - **Settings** optimized for Lua development\n   - **Launch configurations** for debugging\n   - **Code formatting** with StyLua\n\n### Available Make Commands\n\n```bash\nmake test              # Run tests\nmake lint              # Lint code with luacheck\nmake format            # Format code with stylua\nmake docs              # Generate documentation\nmake ci                # Full CI check\nmake pack              # Create LuaRocks package\nmake upload-luarocks   # Upload to LuaRocks (requires login)\n```\n\n## License\n\nMIT License - see the LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\nFor development:\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Run `make ci` to ensure all checks pass\n5. Submit a pull request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuravkovigor%2Flove-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhuravkovigor%2Flove-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuravkovigor%2Flove-i18n/lists"}