本文整理汇总了C#中ITranslator.GetTranslatedString方法的典型用法代码示例。如果您正苦于以下问题:C# ITranslator.GetTranslatedString方法的具体用法?C# ITranslator.GetTranslatedString怎么用?C# ITranslator.GetTranslatedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITranslator
的用法示例。
在下文中一共展示了ITranslator.GetTranslatedString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
// Style Switcher
vars.Add("styles1", translator.GetTranslatedString("styles1"));
vars.Add("styles2", translator.GetTranslatedString("styles2"));
vars.Add("styles3", translator.GetTranslatedString("styles3"));
vars.Add("styles4", translator.GetTranslatedString("styles4"));
vars.Add("styles5", translator.GetTranslatedString("styles5"));
vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText"));
vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText"));
vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText"));
// Language Switcher
vars.Add("en", translator.GetTranslatedString("en"));
vars.Add("fr", translator.GetTranslatedString("fr"));
vars.Add("de", translator.GetTranslatedString("de"));
vars.Add("it", translator.GetTranslatedString("it"));
vars.Add("es", translator.GetTranslatedString("es"));
vars.Add("nl", translator.GetTranslatedString("nl"));
return vars;
}
示例2: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
if (requestParameters.ContainsKey("Submit"))
{
string title = requestParameters["NewsTitle"].ToString();
string text = requestParameters["NewsText"].ToString();
IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
GridNewsItem item = new GridNewsItem {Text = text, Time = DateTime.Now, Title = title};
item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
response = "<h3>News item added successfully, redirecting to main page</h3>" +
"<script language=\"javascript\">" +
"setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
"</script>";
return null;
}
vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
vars.Add("Submit", translator.GetTranslatedString("Submit"));
return vars;
}
示例3: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
{
var vars = new Dictionary<string, object>();
IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
GridNewsItem news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
if (news != null)
{
vars.Add("NewsTitle", news.Title);
vars.Add("NewsText", news.Text);
vars.Add("NewsID", news.ID.ToString());
}
else
{
if (httpRequest.Query["newsid"].ToString() == "-1")
{
vars.Add("NewsTitle", "No news to report");
vars.Add("NewsText", "");
}
else
{
vars.Add("NewsTitle", "Invalid News Item");
vars.Add("NewsText", "");
}
vars.Add("NewsID", "-1");
}
vars.Add("News", translator.GetTranslatedString("News"));
vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
return vars;
}
示例4: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
{
var vars = new Dictionary<string, object>();
IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
GridNewsItem news;
if (requestParameters.ContainsKey("Submit"))
{
string title = requestParameters["NewsTitle"].ToString();
string text = requestParameters["NewsText"].ToString();
string id = requestParameters["NewsID"].ToString();
news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", id);
connector.RemoveGeneric(UUID.Zero, "WebGridNews", id);
GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) };
connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD());
vars["ErrorMessage"] = "News item edit successfully";
webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename);
return vars;
}
else
vars["ErrorMessage"] = "";
news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
vars.Add("NewsTitle", news.Title);
vars.Add("NewsText", news.Text);
vars.Add("NewsID", news.ID.ToString());
vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
vars.Add("Submit", translator.GetTranslatedString("Submit"));
return vars;
}
示例5: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
{
var vars = new Dictionary<string, object>();
if (requestParameters.ContainsKey("Submit"))
{
string title = requestParameters["NewsTitle"].ToString();
string text = requestParameters["NewsText"].ToString();
IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
GridNewsItem item = new GridNewsItem { Text = text, Time = DateTime.Now, Title = title };
item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
vars["ErrorMessage"] = "News item added successfully";
webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename);
return vars;
}
else
vars["ErrorMessage"] = "";
vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
vars.Add("Submit", translator.GetTranslatedString("Submit"));
return vars;
}
示例6: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
GridNewsItem news;
if (requestParameters.ContainsKey("Submit"))
{
string title = requestParameters["NewsTitle"].ToString();
string text = requestParameters["NewsText"].ToString();
string id = requestParameters["NewsID"].ToString();
news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", id);
connector.RemoveGeneric(UUID.Zero, "WebGridNews", id);
GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) };
connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD());
response = "<h3>News item editted successfully, redirecting to main page</h3>" +
"<script language=\"javascript\">" +
"setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
"</script>";
return null;
}
news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
vars.Add("NewsTitle", news.Title);
vars.Add("NewsText", news.Text);
vars.Add("NewsID", news.ID.ToString());
vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
vars.Add("Submit", translator.GetTranslatedString("Submit"));
return vars;
}
示例7: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
{
var vars = new Dictionary<string, object>();
vars.Add("WebsiteDownInfoText", translator.GetTranslatedString("WebsiteDownInfoText"));
vars.Add("WebsiteDownText", translator.GetTranslatedString("WebsiteDownText"));
return vars;
}
示例8: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
vars.Add("Error404Text", translator.GetTranslatedString("Error404Text"));
vars.Add("Error404InfoText", translator.GetTranslatedString("Error404InfoText"));
vars.Add("HomePage404Text", translator.GetTranslatedString("HomePage404Text"));
return vars;
}
示例9: ShortMonthSelections
public static List<Dictionary<string, object>> ShortMonthSelections (ITranslator translator)
{
// index is assumed Jan - 1 etc
var monthsArgs = new List<Dictionary<string, object>> ();
monthsArgs.Add (new Dictionary<string, object> {
{"Value", translator.GetTranslatedString("Jan_Short")} });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Feb_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Mar_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Apr_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("May_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Jun_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Jul_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Aug_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Sep_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Oct_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("Nov_Short") } });
monthsArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString("Dec_Short")}});
return monthsArgs;
}
示例10: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
var settings = connector.GetGeneric<GridSettings>(UUID.Zero, "WebSettings", "Settings");
if (requestParameters.ContainsKey("Submit"))
{
settings.MapCenter.X = int.Parse(requestParameters["GridCenterX"].ToString());
settings.MapCenter.Y = int.Parse(requestParameters["GridCenterY"].ToString());
settings.HideLanguageTranslatorBar = requestParameters["HideLanguageBar"].ToString() == "1";
settings.HideStyleBar = requestParameters["HideStyleBar"].ToString() == "1";
connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD());
response = "Successfully updated settings.";
return null;
}
else if (requestParameters.ContainsKey("IgnorePagesUpdates"))
{
settings.LastPagesVersionUpdateIgnored = PagesMigrator.CurrentVersion;
connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD());
}
else if (requestParameters.ContainsKey("IgnoreSettingsUpdates"))
{
settings.LastSettingsVersionUpdateIgnored = PagesMigrator.CurrentVersion;
connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD());
}
vars.Add("GridCenterX", settings.MapCenter.X);
vars.Add("GridCenterY", settings.MapCenter.Y);
vars.Add("HideLanguageBarNo", !settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
vars.Add("HideLanguageBarYes", settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
vars.Add("HideStyleBarNo", !settings.HideStyleBar ? "selected=\"selected\"" : "");
vars.Add("HideStyleBarYes", settings.HideStyleBar ? "selected=\"selected\"" : "");
vars.Add("IgnorePagesUpdates", PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored) ? "" : "checked");
vars.Add("IgnoreSettingsUpdates", settings.LastSettingsVersionUpdateIgnored != SettingsMigrator.CurrentVersion ? "" : "checked");
vars.Add("SettingsManager", translator.GetTranslatedString("SettingsManager"));
vars.Add("IgnorePagesUpdatesText", translator.GetTranslatedString("IgnorePagesUpdatesText"));
vars.Add("IgnoreSettingsUpdatesText", translator.GetTranslatedString("IgnoreSettingsUpdatesText"));
vars.Add("GridCenterXText", translator.GetTranslatedString("GridCenterXText"));
vars.Add("GridCenterYText", translator.GetTranslatedString("GridCenterYText"));
vars.Add("HideLanguageBarText", translator.GetTranslatedString("HideLanguageBarText"));
vars.Add("HideStyleBarText", translator.GetTranslatedString("HideStyleBarText"));
vars.Add("Save", translator.GetTranslatedString("Save"));
vars.Add("No", translator.GetTranslatedString("No"));
vars.Add("Yes", translator.GetTranslatedString("Yes"));
return vars;
}
示例11: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
vars.Add("Logout", translator.GetTranslatedString("Logout"));
vars.Add("LoggedOutSuccessfullyText", translator.GetTranslatedString("LoggedOutSuccessfullyText"));
Authenticator.RemoveAuthentication(httpRequest);
return vars;
}
示例12: YesNoSelection
public static List<Dictionary<string, object>> YesNoSelection (ITranslator translator, bool condition)
{
var yesNoArgs = new List<Dictionary<string, object>> ();
yesNoArgs.Add (new Dictionary<string, object> {
{"Value", translator.GetTranslatedString("Yes")},
{"selected", condition ? "selected" : ""}
});
yesNoArgs.Add (new Dictionary<string, object> {
{ "Value", translator.GetTranslatedString ("No") },
{"selected", !condition ? "selected" : ""}
});
return yesNoArgs;
}
示例13: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
if (httpRequest.Query.Contains("delete"))
{
string newsID = httpRequest.Query["delete"].ToString();
connector.RemoveGeneric(UUID.Zero, "WebGridNews", newsID);
vars["Success"] = "Successfully deleted the news item";
}
else
vars["Success"] = "";
var newsItems = connector.GetGenerics<GridNewsItem>(UUID.Zero, "WebGridNews");
vars.Add("News", newsItems.ConvertAll<Dictionary<string, object>>(item => item.ToDictionary()));
vars.Add("NewsManager", translator.GetTranslatedString("NewsManager"));
vars.Add("EditNewsItem", translator.GetTranslatedString("EditNewsItem"));
vars.Add("AddNewsItem", translator.GetTranslatedString("AddNewsItem"));
vars.Add("DeleteNewsItem", translator.GetTranslatedString("DeleteNewsItem"));
vars.Add("NewsTitleText", translator.GetTranslatedString("NewsTitleText"));
vars.Add("NewsDateText", translator.GetTranslatedString("NewsDateText"));
vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
vars.Add("DeleteNewsText", translator.GetTranslatedString("DeleteNewsText"));
return vars;
}
示例14: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
if (requestParameters.ContainsKey("ResetMenu"))
{
PagesMigrator.ResetToDefaults();
response = "Menu: "+ translator.GetTranslatedString("ChangesSavedSuccessfully");
return null;
}
if (requestParameters.ContainsKey("ResetSettings"))
{
SettingsMigrator.ResetToDefaults(webInterface);
response = "WebUI: "+ translator.GetTranslatedString("ChangesSavedSuccessfully");
return null;
}
vars.Add("FactoryReset", translator.GetTranslatedString("FactoryReset"));
vars.Add("ResetMenuText", translator.GetTranslatedString("ResetMenuText"));
vars.Add("ResetSettingsText", translator.GetTranslatedString("ResetSettingsText"));
vars.Add("ResetMenuInfoText", translator.GetTranslatedString("ResetMenuText"));
vars.Add("ResetSettingsInfoText", translator.GetTranslatedString("ResetSettingsInfoText"));
vars.Add("Reset", translator.GetTranslatedString("Reset"));
return vars;
}
示例15: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
var usersList = new List<Dictionary<string, object>>();
uint amountPerQuery = 10;
int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0;
uint count = DataManager.DataManager.RequestPlugin<IAgentInfoConnector>().RecentlyOnline(5 * 60, true);
int maxPages = (int)(count / amountPerQuery) - 1;
if (start == -1)
start = (int)(maxPages < 0 ? 0 : maxPages);
vars.Add("CurrentPage", start);
vars.Add("NextOne", start + 1 > maxPages ? start : start + 1);
vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1);
var users = DataManager.DataManager.RequestPlugin<IAgentInfoConnector>().RecentlyOnline(5 * 60, true, new Dictionary<string, bool>(), (uint)start, amountPerQuery);
IUserAccountService accountService = webInterface.Registry.RequestModuleInterface<IUserAccountService>();
IGridService gridService = webInterface.Registry.RequestModuleInterface<IGridService>();
foreach (var user in users)
{
var region = gridService.GetRegionByUUID(null, user.CurrentRegionID);
var account = accountService.GetUserAccount(region.AllScopeIDs, UUID.Parse(user.UserID));
if (account != null && region != null)
usersList.Add(new Dictionary<string, object> { { "UserName", account.Name },
{ "UserRegion", region.RegionName }, { "UserID", user.UserID }, { "UserRegionID", region.RegionID } });
}
if (requestParameters.ContainsKey("Order"))
{
if (requestParameters["Order"].ToString() == "RegionName")
usersList.Sort((a, b) => a["UserRegion"].ToString().CompareTo(b["UserRegion"].ToString()));
if (requestParameters["Order"].ToString() == "UserName")
usersList.Sort((a, b) => a["UserName"].ToString().CompareTo(b["UserName"].ToString()));
}
vars.Add("UsersOnlineList", usersList);
vars.Add("OnlineUsersText", translator.GetTranslatedString("OnlineUsersText"));
vars.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText"));
vars.Add("FirstText", translator.GetTranslatedString("FirstText"));
vars.Add("BackText", translator.GetTranslatedString("BackText"));
vars.Add("NextText", translator.GetTranslatedString("NextText"));
vars.Add("LastText", translator.GetTranslatedString("LastText"));
vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText"));
return vars;
}