This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!String.prototype.format) { | |
| String.prototype.format = function () { | |
| var args = arguments; | |
| return this.replace(/{(\d+)}/g, function (match, number) { | |
| return typeof args[number] != 'undefined' | |
| ? args[number] | |
| : match | |
| ; | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function parseUrl (url) { | |
| var loc = { | |
| href: url, | |
| parts : url.replace('//','/').split('/') | |
| }; | |
| loc.protocol = parts[0]; | |
| loc.host = parts[1]; | |
| parts[1] = parts[1].split(':'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mySiteNamespace = {} | |
| mySiteNamespace.switchLanguage = function (lang) { | |
| $.cookie('language', lang); | |
| window.location.reload(); | |
| } | |
| $(document).ready(function () { | |
| // attach mySiteNamespace.switchLanguage to click events based on css classes | |
| $('.lang-english').click(function () { mySiteNamespace.switchLanguage('en'); }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace System.Web.Mvc | |
| { | |
| public static class LocalizationHelpers | |
| { | |
| public static IHtmlString MetaAcceptLanguage<t>(this HtmlHelper<t> html) | |
| { | |
| var acceptLanguage = HttpUtility.HtmlAttributeEncode(Threading.Thread.CurrentThread.CurrentUICulture.ToString()); | |
| return new HtmlString(String.Format("<meta name="\" accept-language\""="" content="\" {0}\""="">",acceptLanguage)); | |
| } | |
| } |