{"id":18473740,"url":"https://github.com/yasinkuyu/localization","last_synced_at":"2026-04-02T02:47:57.081Z","repository":{"id":17367829,"uuid":"20139658","full_name":"yasinkuyu/Localization","owner":"yasinkuyu","description":":fire: Create multi-language structure with ASP.NET MVC","archived":false,"fork":false,"pushed_at":"2019-12-31T10:46:02.000Z","size":60,"stargazers_count":38,"open_issues_count":2,"forks_count":19,"subscribers_count":4,"default_branch":"Haster","last_synced_at":"2024-04-30T01:02:00.738Z","etag":null,"topics":["c-sharp","i18n","localization","net-mvc"],"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/yasinkuyu.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":"2014-05-24T21:07:27.000Z","updated_at":"2024-04-11T04:52:01.000Z","dependencies_parsed_at":"2022-09-04T17:42:05.238Z","dependency_job_id":null,"html_url":"https://github.com/yasinkuyu/Localization","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasinkuyu%2FLocalization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasinkuyu%2FLocalization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasinkuyu%2FLocalization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasinkuyu%2FLocalization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yasinkuyu","download_url":"https://codeload.github.com/yasinkuyu/Localization/tar.gz/refs/heads/Haster","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247842715,"owners_count":21005335,"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":["c-sharp","i18n","localization","net-mvc"],"created_at":"2024-11-06T10:26:14.452Z","updated_at":"2026-04-02T02:47:56.772Z","avatar_url":"https://github.com/yasinkuyu.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Localization\n============\n\nCreate `multi-language` structure with ASP.NET MVC [@yasinkuyu](https://twitter.com/yasinkuyu)\n\n    PM\u003e Install-Package Localization\n\n\n### Usage\n\n    - \u003cli\u003e@Html.ActionLinkLocalization(\"English\", \"Index\", \"Locales\", new { lang = \"en_US\" })\u003c/li\u003e\n    - \u003cli\u003e@Html.ActionLinkLocalization(\"Türkçe\", \"Index\", \"Locales\", new { lang = \"tr_TR\" })\u003c/li\u003e\n    and more...\n    Or\n    - \u003ca href=\"Locales/?lang=en_US\"\u003eEnglish\u003c/a\u003e\n    - \u003ca href=\"Locales/?lang=tr_TR\"\u003eTürkçe\u003c/a\u003e\n    and more...\n\nIndex.cshtml\n\n    @Html.Get(\"homepage\") or @Html.Localize(\"homepage\")\n\n\n### Video Tutorial\n\n\n\n[![ASP.NET MVC Localization Tutorial vimeo](https://i.vimeocdn.com/video/476545847_295x166.jpg)](https://vimeo.com/96483908)\n\n\n[![ASP.NET MVC Localization Tutorial youtube](https://i.vimeocdn.com/video/476545847_295x166.jpg)](http://youtu.be/9V5PS4m0er0)\n\n\n\nRequirements\n---------------  \n\nLocalization\n  - en_US.xml\n  - tr_TR.xml\n  - and more...\n  \nBin\n  - Insya.Localization.dll\n  - System.ComponentModel.DataAnnotations\n\n\n\nDefault locale\n\t\n\tpublic void DefaultLocale( )\n\t{\n\t    HttpCookie cookie = Request.Cookies.Get(\"CacheLang\");\n\t    if ( cookie == null)\n\t    {\n\t        HttpCookie newCookie = new HttpCookie(\"CacheLang\");\n\t        newCookie.Value = \"en_US\";\n\t        Response.Cookies.Add(newCookie);\n\t    }\n\t}\n\n\nStructure\n---------------\n\n### Views\n    Xml file\n    \u003citem id=\"homepage\"\u003eHome Page\u003c/item\u003e\n    \n    Razor\n         @Html.Localize(\"homepage\")\n         Or\n         @Html.Get(\"homepage\")\n      \n    Code Behind\n         Localization.Localize(\"homepage\")\n         Or\n         Localization.Get(\"homepage\")\n    \n    @Html.ActionLinkLocalization()\n    @Html.ActionLocalization()\n\n\n### Inline Localization\n\t\n\t@Html.Get(new Inline(en: \"book\", tr: \"kitap\"))\n\t@Html.Localize(new Inline(en: \"book\", tr: \"kitap\"))\n\n\n\n\n\n### Controllers\n\n```\npublic ActionResult Index(string lang = \"en_US\")\n{\n  Response.Cookies[\"CacheLang\"].Value = lang;\n  \n  if (Request.UrlReferrer != null)\n  Response.Redirect(Request.UrlReferrer.ToString());\n  \n  var message = Localization.Get(\"changedlng\");\n  \n  return Content(message);\n}\n```\n\n### Models\n  \n    Attribute Localize\n      Display Attribute \n        [DisplayLocalize(\"username\")]\n        public string Username { get; set; }\n      \n      String Length Attribute \n        [StringLengthLocalize(20, MinimumLength = 4)]\n        public string DisplayName { get; set; }\n      \n      Required Attribute \n        [RequiredLocalized]\n        public string DisplayName { get; set; }\n      \n      Description Attribute \n        [DescriptionLocalize]\n        public string DisplayName { get; set; }\n\n----------\n\n**Intellisense in razor files (Views/web.config)**\n- Views\n    - web.config\n        - system.web.webPages.razor\n            - pages\n                - namespaces\n                    - add namespace=\"Insya.Localization\" \n                    - add namespace=\"Insya.Localization.Helpers\" \n\n\nExample \n\n```\n\u003csystem.web.webPages.razor\u003e\n  \u003chost factoryType=\"System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" /\u003e\n      \u003cpages pageBaseType=\"System.Web.Mvc.WebViewPage\"\u003e\n          \u003cnamespaces\u003e\n          \u003cadd namespace=\"System.Web.Mvc\" /\u003e\n          \u003cadd namespace=\"System.Web.Mvc.Ajax\" /\u003e\n          \u003cadd namespace=\"System.Web.Mvc.Html\" /\u003e\n          \u003cadd namespace=\"System.Web.Optimization\"/\u003e\n          \u003cadd namespace=\"System.Web.Routing\" /\u003e\n          ## \u003cadd namespace=\"Insya.Localization\" /\u003e\n          ## \u003cadd namespace=\"Insya.Localization.Helpers\" /\u003e\n          \u003c/namespaces\u003e\n      \u003c/pages\u003e\n\u003c/system.web.webPages.razor\u003e\n```\n\n**Note:** Nuget package auto insert \u003cadd namespace=\"Insya.Localization\" /\u003e  \u003cadd namespace=\"Insya.Localization.Helpers\" /\u003e\n\n### Language Codes\n\nhttps://msdn.microsoft.com/en-us/library/ms533052(v=vs.85).aspx\n\n### Contribution\nFork\n\n\n**Roadmap:**\n- Localizable Routing\n- All the XML language files editing tool on one screen.\n- Testing tools\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasinkuyu%2Flocalization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasinkuyu%2Flocalization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasinkuyu%2Flocalization/lists"}