Webserver: -mod: translations are now in external json files
This commit is contained in:
1 parent
d4552d5860
commit
14835e2e24
6 files changed
+225
-179
No files matched your search
@@ -269,6 +269,31 @@ namespace ServerLib
|
||||
return null;
|
||||
}
|
||||
|
||||
public Stream GetLocaleFile(string filename)
|
||||
{
|
||||
if (WebOperationContext.Current != null)
|
||||
{
|
||||
WebOperationContext.Current.OutgoingResponse.ContentType = "text/javascript";
|
||||
WebOperationContext.Current.OutgoingResponse.LastModified = DateTime.UtcNow;
|
||||
WebOperationContext.Current.OutgoingResponse.Headers.Add(
|
||||
HttpResponseHeader.Expires,
|
||||
DateTime.UtcNow.AddHours(4).ToString("r"));
|
||||
}
|
||||
|
||||
byte[] data = CServer.GetSiteFile("locales/" + filename);
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
return new MemoryStream(data);
|
||||
}
|
||||
|
||||
if (WebOperationContext.Current != null)
|
||||
{
|
||||
WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.NotFound;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public CBase64Image GetDelayedImage(string id)
|
||||
{
|
||||
return CServer.GetDelayedImage(id);
|
||||
@@ -428,6 +453,6 @@ namespace ServerLib
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,12 @@ namespace ServerLib
|
||||
UriTemplate = "/img/{filename}")]
|
||||
Stream GetImgFile(String filename);
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/locales/{filename}")]
|
||||
Stream GetLocaleFile(String filename);
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
|
||||
Reference in new issue
Block a user