{"id":14965070,"url":"https://github.com/antelcat/i18n","last_synced_at":"2026-03-01T16:02:14.923Z","repository":{"id":203977159,"uuid":"709871816","full_name":"Antelcat/I18N","owner":"Antelcat","description":"Reactive language support for WPF/Avalonia applications when using .resx file.","archived":false,"fork":false,"pushed_at":"2026-01-19T12:15:31.000Z","size":580,"stargazers_count":150,"open_issues_count":5,"forks_count":16,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-24T05:03:23.895Z","etag":null,"topics":["avalonia","dotnet","extension","i18n","languages","localization","markup","mvvm","source-generator","wpf"],"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/Antelcat.png","metadata":{"files":{"readme":"README.en.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-10-25T15:02:47.000Z","updated_at":"2026-01-30T10:30:09.000Z","dependencies_parsed_at":"2026-02-24T05:03:31.871Z","dependency_job_id":null,"html_url":"https://github.com/Antelcat/I18N","commit_stats":{"total_commits":73,"total_committers":1,"mean_commits":73.0,"dds":0.0,"last_synced_commit":"e46be5e015fa575b445ea956edfd38d10f551062"},"previous_names":["antelcat/antelcat.wpf.i18n","antelcat/antelcat.i18n"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Antelcat/I18N","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FI18N","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FI18N/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FI18N/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FI18N/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Antelcat","download_url":"https://codeload.github.com/Antelcat/I18N/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FI18N/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T15:41:30.362Z","status":"ssl_error","status_checked_at":"2026-03-01T15:37:07.343Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","dotnet","extension","i18n","languages","localization","markup","mvvm","source-generator","wpf"],"created_at":"2024-09-24T13:34:10.501Z","updated_at":"2026-03-01T16:02:14.914Z","avatar_url":"https://github.com/Antelcat.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ch1\u003e\n\nAntelcat.`{I18N}`\n\n\u003c/h1\u003e\n\nReactive language support for .NET applications.\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"dotnet-version\" src=\"https://img.shields.io/badge/WPF-%3E%3D4.0-2C896A.svg\"/\u003e\n\u003cimg alt=\"dotnet-version\" src=\"https://img.shields.io/badge/Avalonia-%3E%3D11.0-AE42F8.svg\"/\u003e\n    \u003cimg alt=\"csharp-version\" src=\"https://img.shields.io/badge/C%23-preview-3BA93F.svg\"/\u003e\n    \u003cimg alt=\"nuget\" src=\"https://img.shields.io/badge/Nuget-v1.0.0-blue.svg\"/\u003e\n\u003c/p\u003e\n\n---\n\n🇨🇳 [中文版](./README.md)\n\n## 🗔 Supported Platforms\n\n+ [WPF](https://github.com/dotnet/wpf)\n+ [Avalonia](https://github.com/AvaloniaUI/Avalonia)\n\n## 📖 Sample\n\n\u003cdiv float=\"right\"\u003e\n    \u003cimg src=\"docs/demo.zh.png\" width=\"45%\"/\u003e\n    \u003cimg src=\"docs/demo.en.png\" width=\"45%\"/\u003e \n\u003c/div\u003e\n\n\n### Static using\nWhen using `.resx` language file in your project, you can \nautomatically generate resource keys by using `Antelcat.I18N.Attributes.ResourceKeysOfAttribute`:\n\n```csharp\nusing Antelcat.I18N.Attributes;\n\nnamespace MyProject\n\n//Auto generated class should be partial\n[ResourceKeysOf(typeof(My.Resource.Designer.Type))]\npublic partial class LangKeys;\n```\n\nThen in your `.xaml` file you can use `x:Static` to provide resource key to your control\n\n+ on `Avalonia` platform and using greater than the version of 2.0.0, you should call in `App.axaml`\n\n    ```csharp\n    LangKeys.Your_Provider.Initialize();\n    ```\n  `WPF` can ignore this procedure\n\n\nif you already have \n```xml\n\u003cdata name=\"Language\" xml:space=\"preserve\"\u003e\n    \u003cvalue\u003eLanguage\u003c/value\u003e\n\u003c/data\u003e\n```\nin your `.resx` file, you can use it like this:\n```xaml\n\u003cTextBolck Text=\"{x:Static myProject:LangKeys.Language}\"/\u003e\n```\n\nThen you can use the key to bind the language source using `I18N`\n\n```xaml\n\u003cTextBlock Text=\"{I18N {x:Static myProject:LangKeys.Language}}\"/\u003e\n```\n\nWhen you want to change the language, just call\n\n```csharp\nusing System.Windows;\n\nI18NExtension.Culture = new CultureInfo(\"language code\");\n```\nYou can see the text is changing among the languages.\n\n---\n\n### Dynamic using\n\nSometimes your source text is not defined in your application but received from other source like network, you can use `I18N` to bind the text directly.\n\nIf you receive a json like this:\n```json\n{\n    \"message\": \"This is a message\"\n}\n```\nand you have translated it into another language in `.resx` like\n```xml\n\u003cdata name=\"This is a message\" xml:space=\"preserve\"\u003e\n    \u003cvalue\u003e这是一条消息\u003c/value\u003e\n\u003c/data\u003e\n```\n\nthen you put the json into a `Message` property in your view model, you can bind it like this:\n\n```xaml\n\u003c!--whose DataContext is your view model--\u003e\n\u003cTextBlock Text=\"{I18N {Binding Message}}\"/\u003e \n```\n\nEach time when the `Message` property is changed or the language source is changed, the text will be updated automatically.\n\n---\n\n### Combination and StringFormat\n\nSomebody may want to combine several language sources into one text, you can also use `I18N` and `LanguageBinding` to do this\n\nIf you have source text in `.resx` file like this:\n```xml\n\u003cdata name=\"Current_is\" xml:space=\"preserve\"\u003e\n    \u003cvalue\u003e当前的 {0} 是 {1}\u003c/value\u003e\n\u003c/data\u003e\n\u003cdata name=\"Language\" xml:space=\"preserve\"\u003e\n    \u003cvalue\u003e语言\u003c/value\u003e\n\u003c/data\u003e\n\u003cdata name=\"Chinese\" xml:space=\"preserve\"\u003e\n    \u003cvalue\u003e中文\u003c/value\u003e\n\u003c/data\u003e\n```\n\nand in `.xaml` \n\n```xaml\n\u003cTextBlock\u003e\n    \u003cTextBlock.Text\u003e\n        \u003cI18N Key=\"{x:Static myProject:LangKeys.Current_is}\"\u003e\n            \u003cLanguageBinding Key=\"{x:Static myProject:LangKeys.Language}\"/\u003e\n            \u003cBinding Path=\"Language\"/\u003e \u003c!--source text from view model--\u003e\n        \u003c/I18N\u003e\n    \u003c/TextBlock.Text\u003e\n\u003c/TextBlock\u003e\n```\n\n`I18N.Key` is the `string` template, content accepts `LanguageBinding` and `Binding` to provide the args.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fi18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantelcat%2Fi18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fi18n/lists"}