{"id":19260188,"url":"https://github.com/kulikov-dev/avalonia.localizer","last_synced_at":"2025-09-17T11:07:35.488Z","repository":{"id":74401596,"uuid":"604767920","full_name":"kulikov-dev/Avalonia.Localizer","owner":"kulikov-dev","description":"Easy-to-use localization provider for the AvaloniaUI","archived":false,"fork":false,"pushed_at":"2023-03-05T19:32:30.000Z","size":89,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-21T16:40:15.778Z","etag":null,"topics":["avalonia","avaloniaui","example-project","l10n","localization","localization-tool","xunit"],"latest_commit_sha":null,"homepage":"","language":"C#","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/kulikov-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-02-21T18:45:46.000Z","updated_at":"2025-04-18T10:46:25.000Z","dependencies_parsed_at":"2023-04-24T12:24:45.915Z","dependency_job_id":null,"html_url":"https://github.com/kulikov-dev/Avalonia.Localizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kulikov-dev/Avalonia.Localizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulikov-dev%2FAvalonia.Localizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulikov-dev%2FAvalonia.Localizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulikov-dev%2FAvalonia.Localizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulikov-dev%2FAvalonia.Localizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kulikov-dev","download_url":"https://codeload.github.com/kulikov-dev/Avalonia.Localizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulikov-dev%2FAvalonia.Localizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275583378,"owners_count":25490651,"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-09-17T02:00:09.119Z","response_time":84,"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":["avalonia","avaloniaui","example-project","l10n","localization","localization-tool","xunit"],"created_at":"2024-11-09T19:19:17.885Z","updated_at":"2025-09-17T11:07:35.436Z","avatar_url":"https://github.com/kulikov-dev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Avalonia localizer\n  The sample project comes with a ready-to-use localization provider, allowing for dynamic runtime localization using the  [AvaloniaUI](https://github.com/AvaloniaUI/Avalonia) framework. The idea is to create JSON files as assets. Each file contains a key and translation according to the locale:\n``` JSON\n {\n  \"EnumSample\": \"Primer pretvornika enum\",\n  \"car\": \"Avto\",\n  \"plane\": \"Letalo\",\n  \"bicycle\": \"Kolo\",\n  \"SampleTranslate\": \"To je primer besedila, uporabljenega za lokalizacijo.\"\n}\n```\nThan you can use the localizer in XAML, code or with enums:\n``` C#\n\\\\ XAML\nxmlns:localization=\"clr-namespace:Avalonia.Localizer.Core.Localization\"\n\u003cTextBlock FontSize=\"18\" Margin=\"0,10,0,0\" Text=\"{localization:Localize SampleTranslate}\"/\u003e\n\n\\\\ XAML for Enum\n\u003cWindow.Resources\u003e\n   \u003cconverters:EnumDescriptionConverter x:Key=\"enumConverter\" /\u003e\n\u003c/Window.Resources\u003e\n\n\u003cComboBox.ItemTemplate\u003e\n  \u003cDataTemplate\u003e\n     \u003cTextBlock Text=\"{Binding Converter={StaticResource enumConverter}}\"/\u003e\n  \u003c/DataTemplate\u003e\n\u003c/ComboBox.ItemTemplate\u003e\n\n\\\\ Code\nvar localized = ProgramCore.Localizer[\"plane\"];\n\n\\\\ In Enum, where in the Description attribute we use the localization key\n public enum SampleEnum\n    {\n        [Description(\"car\")]\n        Car,\n    }\n    \n EnumDescriptionConverter.GetEnumDescription(SampleEnum.Car);\n```\nThanks to bindings, we can change the locale in the runtime with just one line of code:\n``` C#\nProgramCore.Localizer.SwitchLanguage(\"en-US\");\n```  \n  \u003cp align=\"center\"\u003e \u003cimg src=\"Avalonia.Localizer\\Assets\\SampleEn.jpg\" width=\"450\" align=\"center\" title=\"Screenshot with English locale\"\u003e \u003c/p\u003e \u003cp align=\"center\"\u003e \u003cimg src=\"Avalonia.Localizer\\Assets\\SampleSl.jpg\" width=\"450\" align=\"center\" title=\"Screenshot with Slovenian locale\"\u003e \u003c/p\u003e\n\nCredits to [sakya](https://github.com/sakya/) for the idea.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkulikov-dev%2Favalonia.localizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkulikov-dev%2Favalonia.localizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkulikov-dev%2Favalonia.localizer/lists"}