using System.IO;
using System.Net;
using System.Web;
using System.Web.UI;

/// <summary>
/// Summary description for i18n
/// </summary>
public static class i18n
{
    public static string GetJedLocaleData(string siteLang)
    {
        WebClient client = new WebClient();
        string text = "";
        try
        {
            string url =
                "http://"
                + HttpContext.Current.Request.Url.Host
                + ":" + HttpContext.Current.Request.Url.Port
                + ((Page)HttpContext.Current.Handler).ResolveUrl("~/app/i18n/resx2json.aspx?path=dataLocalization&customPath=app/i18n&appendASPXExt=false");

            Stream stream = client.OpenRead(url);
            StreamReader reader = new StreamReader(stream);
            text = reader.ReadToEnd();
        }
        catch
        {
            text = "{ 'messages': { '': { 'domain': 'messages', 'lang':'en', 'plural_forms':'' } } }";
        }

        return text; 
    }
}