{"id":23273107,"url":"https://github.com/zhaytam/easylocalization","last_synced_at":"2025-08-21T05:31:33.907Z","repository":{"id":37839632,"uuid":"121130846","full_name":"zHaytam/EasyLocalization","owner":"zHaytam","description":"A simple library that makes WPF Localization easier","archived":false,"fork":false,"pushed_at":"2022-12-08T00:46:30.000Z","size":42,"stargazers_count":23,"open_issues_count":3,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T04:11:24.788Z","etag":null,"topics":["csharp","localization","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/zHaytam.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}},"created_at":"2018-02-11T14:20:43.000Z","updated_at":"2025-02-21T16:40:33.000Z","dependencies_parsed_at":"2023-01-25T01:45:43.920Z","dependency_job_id":null,"html_url":"https://github.com/zHaytam/EasyLocalization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zHaytam/EasyLocalization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FEasyLocalization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FEasyLocalization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FEasyLocalization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FEasyLocalization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zHaytam","download_url":"https://codeload.github.com/zHaytam/EasyLocalization/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FEasyLocalization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271430721,"owners_count":24758356,"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-08-21T02:00:08.990Z","response_time":74,"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":["csharp","localization","wpf"],"created_at":"2024-12-19T19:32:34.493Z","updated_at":"2025-08-21T05:31:33.629Z","avatar_url":"https://github.com/zHaytam.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# EasyLocalization\n\nA simple library that makes WPF Localization easier.\n\n## Features\n\n- An easy extension to use `{l:Localize Title1}`\n- Handles bindable Key `{l:Localize Key={Binding TitleKey}}`\n- Handles alternative keys when the Key is not provided or not found (ControlName_PropertyName, e.g. Button1_Content)\n- Handles singular, zero and plural values `{l:Localize Key=Sentence1, CountSource={Binding Value}}`\n  - The zero form is automatically used when the Count value is equal to 0\n  - The plural form is automatically used when the Count value is greater than 0\n- Ability to change the current culture without having to restart the application.\n\n## Demo\n\n![Demo GIF](https://i.imgur.com/fEO8Fjp.gif)\n\n## How to use\n\n### Things that you should know\n\n- **EasyLocation** doesn't use resources.resx files (at least for now).\n- **EasyLocation** works with cultures to identify languages (`CultureInfo` class)\n- There are only 3 types of readers for now:\n  - CharSeperatedFileReader: Each line is considered to have at least a key and a value seperated by a char (e.g. [en-US.txt](https://github.com/zHaytam/EasyLocalization/blob/master/EasyLocalization.Demo/Resources/en-US.txt))\n  - JsonFileReader: A json file of a key-object format (e.g. [fr.json](https://github.com/zHaytam/EasyLocalization/blob/master/EasyLocalization.Demo/Resources/fr.json))\n  - XmlFileReader: A xml file with an `\u003cEntries\u003e` root and `\u003cEntry\u003e` elements, each must have a key attribute (e.g. [es-ES.xml](https://github.com/zHaytam/EasyLocalization/blob/master/EasyLocalization.Demo/Resources/es-ES.xml))\n\n### Adding cultures (languages)\n\nOn startup (for example in App.xaml.cs) you'll have to register the cultures you want your applications to have:\n```\nprotected override void OnStartup(StartupEventArgs e)\n{\n    base.OnStartup(e);\n\n    LocalizationManager.Instance.AddCulture(\n        CultureInfo.GetCultureInfo(\"en-US\"),\n        new CharSeperatedFileReader(\"Resources/en-US.txt\"),\n        true);\n    LocalizationManager.Instance.AddCulture(\n        CultureInfo.GetCultureInfo(\"es-ES\"),\n        new XmlFileReader(\"Resources/es-ES.xml\"));\n    LocalizationManager.Instance.AddCulture(\n        CultureInfo.GetCultureInfo(\"fr\"),\n        new JsonFileReader(\"Resources/fr.json\"));\n}\n```\n\nThe `true` in the first `AddCulture` call tells the `LocalizationManager` to choose this language for now.\n\n### Simple localization\n\n    \u003cTextBlock Margin=\"4\" Text=\"{_:Localize Key1}\" /\u003e\n    \u003cTextBlock Margin=\"4\" Text=\"{_:Localize Key=Key1_1}\" /\u003e\n\n### Bindable Key\n\n    \u003cTextBlock Margin=\"4\" Text=\"{localization:Localize KeySource={Binding Key} /\u003e\n\n### Alterternative Key\n\n    \u003cTextBlock Margin=\"4\" Name=\"LblTitle\" Text=\"{localization:Localize}\" /\u003e\n\nSince the Key is not provided, the `LocalizationManager` will use the alternative key, in this case it's **LblTitle_Text**.\n\n### Handling singular, zero and plural\n\n    \u003cTextBlock Margin=\"4\"\n               Text=\"{localization:Localize KeySource={Binding Key}, \n                                            CountSource={Binding Value}}\" /\u003e\n\nThe LocalizationManager will adapt the Text property whenever the Key or Count change:\n - If the Count value is 0, the `ZeroValue` is chosen.\n - If the Count value is 1, the `Value` is chosen.\n - Otherwise the PluralValue is chosen `string.Format(PluralValue, Count)`\n\n### Changing the culture (language)\n\n    LocalizationManager.Instance.CurrentCulture = CultureInfo.GetCultureInfo(\"fr\");\n\nWhenever the CurrentCulture changes, the whole application is automatically updated without the need to restart it.\n\nFor a list of the available/added cultures:\n\n    LocalizationManager.Instance.AvailableCultures\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaytam%2Feasylocalization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhaytam%2Feasylocalization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaytam%2Feasylocalization/lists"}