{"id":15089325,"url":"https://github.com/aparokshaui/localized","last_synced_at":"2025-10-21T08:19:46.429Z","repository":{"id":225198088,"uuid":"765302461","full_name":"AparokshaUI/Localized","owner":"AparokshaUI","description":"This project has moved to https://git.aparoksha.dev/aparoksha/localized - Easy-to-use, safe and cross-platform library for localizing Swift code","archived":true,"fork":false,"pushed_at":"2024-10-17T19:28:11.000Z","size":264,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-11T12:21:15.664Z","etag":null,"topics":["linux","localization","macos","swift","windows","yaml","yml"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/AparokshaUI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2024-02-29T16:57:04.000Z","updated_at":"2025-02-10T08:28:02.000Z","dependencies_parsed_at":"2024-10-20T01:11:42.432Z","dependency_job_id":null,"html_url":"https://github.com/AparokshaUI/Localized","commit_stats":{"total_commits":12,"total_committers":3,"mean_commits":4.0,"dds":"0.16666666666666663","last_synced_commit":"ecb58cdd5db297eb6012d04daa57a111b224c6e6"},"previous_names":["aparokshaui/localized"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AparokshaUI%2FLocalized","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AparokshaUI%2FLocalized/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AparokshaUI%2FLocalized/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AparokshaUI%2FLocalized/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AparokshaUI","download_url":"https://codeload.github.com/AparokshaUI/Localized/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239785302,"owners_count":19696753,"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":["linux","localization","macos","swift","windows","yaml","yml"],"created_at":"2024-09-25T08:44:53.153Z","updated_at":"2025-10-21T08:19:45.428Z","avatar_url":"https://github.com/AparokshaUI.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]  \n\u003e\n\u003e **This project has moved. You can find it [here](https://git.aparoksha.dev/aparoksha/localized).**\n\u003e\n\u003e The decision is based on [this article](https://sfconservancy.org/GiveUpGitHub/).\n\u003e\n\u003e Thanks to [No GitHub](https://codeberg.org/NoGitHub) for the badge used below.\n\u003e\n\u003e [![No GitHub](https://nogithub.codeberg.page/badge.svg)](https://sfconservancy.org/GiveUpGitHub/)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"256\" alt=\"Localized Icon\" src=\"Icons/Icon.png\"\u003e\n  \u003ch1 align=\"center\"\u003eLocalized\u003c/h1\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/AparokshaUI/Localized\"\u003e\n  GitHub\n  \u003c/a\u003e\n  ·\n  \u003ca href=\"Documentation/README.md\"\u003e\n  Contributor Docs\n  \u003c/a\u003e\n\u003c/p\u003e\n\n_Localized_ provides a Swift package plugin for localizing cross-platform Swift code.\n\nUse YML syntax for defining available phrases:\n\n```yml\nhello(name):\n    en: Hello, (name)!\n    de: Hallo, (name)!\n    fr: Salut, (name)!\n\nhouse:\n    en: House\n    de: Haus\n    fr: Maison\n\nhouses(count):\n    en(count == \"1\"): There is one house.\n    en: There are (count) houses.\n    de(count == \"1\"): Es gibt ein Haus.\n    de: Es gibt (count) Häuser.\n```\n\nThen, access the localized strings safely in your code:\n\n```swift\n// Use the system language\nprint(Loc.hello(name: \"Peter\"))\nprint(Loc.house)\nprint(Loc.houses(count: 1))\n\n// Access the translation for a specific language\nprint(Localized.hello(name: \"Peter\").en)\nprint(Localized.house.fr)\n```\n\n## Table of Contents\n\n- [Installation][4]\n- [Usage][5]\n- [Thanks][6]\n\n## Installation\n\n1. Open your Swift package in GNOME Builder, Xcode, or any other IDE.\n2. Open the `Package.swift` file.\n3. Into the `Package` initializer, under `dependencies`, paste:\n```swift\n.package(url: \"https://github.com/AparokshaUI/Localized\", from: \"0.1.0\")   \n```\n\n## Usage\n\n### Definition\n\nDefine the available phrases in a file called `Localized.yml`.\n\n```yml\ndefault: en\n\nexport:\n    en: Export Document\n    de: Exportiere das Dokument\n\nsend(message, name):\n    en(name == \"\"): Send (message).\n    en: Send (message) to (name).\n    de: Sende (message) to (name).\n```\n\nAs you can see, you can add parameters using brackets after the key,\nand conditions using brackets after the language (e.g. for pluralization).\n\nThe line `default: en` sets English as the fallback language.\n\nThen, add the `Localized` dependency, the plugin and the `Localized.yml` resource\nto the target in the `Package.swift` file.\n\n```swift\n.executableTarget(\n    name: \"PluginTests\",\n    dependencies: [\"Localized\"],\n    resources: [.process(\"Localized.yml\")],\n    plugins: [\"GenerateLocalized\"]\n)\n```\n\n### Usage\n\nIn most cases, you want to get the translated string in the system language.\nThis can be accomplished using the following syntax.\n\n```swift\nlet export = Loc.export\nlet send = Loc.send(message: \"Hello\", name: \"Peter\")\n```\n\nYou can access a specific language as well.\n\n```swift\nlet export = Localized.export.en\nlet send = Localized.send(message: \"Hallo\", name: \"Peter\").de\n```\n\nIf you want to get the translation for a specific language code, use the following syntax.\nThis function will return the translation for the default language if there's no translation for the prefix of that code available.\n\n```swift\nlet export = Localized.export.string(for: \"de-CH\")\n```\n\n## Thanks\n\n### Dependencies\n- [Yams](https://github.com/jpsim/Yams) licensed under the [MIT license](https://github.com/jpsim/Yams/blob/main/LICENSE)\n\n### Other Thanks\n- The [contributors][7]\n- [SwiftLint][8] for checking whether code style conventions are violated\n- The programming language [Swift][9]\n- [SourceDocs][10] used for generating the [docs][11]\n\n[1]:    Tests/\n[2]:\t#goals\n[3]:\t#widgets\n[4]:\t#installation\n[5]:\t#usage\n[6]:\t#thanks\n[7]:\tContributors.md\n[8]:\thttps://github.com/realm/SwiftLint\n[9]:\thttps://github.com/apple/swift\n[10]:\thttps://github.com/SourceDocs/SourceDocs\n[11]:\tDocumentation/README.md\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faparokshaui%2Flocalized","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faparokshaui%2Flocalized","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faparokshaui%2Flocalized/lists"}