本文整理汇总了C#中ITranslator类的典型用法代码示例。如果您正苦于以下问题:C# ITranslator类的具体用法?C# ITranslator怎么用?C# ITranslator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITranslator类属于命名空间,在下文中一共展示了ITranslator类的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>();
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;
}
示例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("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;
}
示例3: 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>();
// Check if we're looking at the standard page or the submitted one
if (requestParameters.ContainsKey("Submit"))
{
}
else
{
//vars.Add("ErrorMessage", error);
vars.Add("SimConsoleText", translator.GetTranslatedString("SimConsoleText"));
vars.Add("SimAddressText", translator.GetTranslatedString("SimAddressText"));
vars.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
vars.Add("PasswordText", translator.GetTranslatedString("PasswordText"));
vars.Add("SendCommandText", translator.GetTranslatedString("SendCommandText"));
vars.Add("Login", translator.GetTranslatedString("Login"));
}
return vars;
}
示例4: GameOfLife
public GameOfLife(String gameInput, GameCriteria criteria,
ITranslator<GameData> translator, BoardFactory boardFactory)
{
this.criteria = criteria;
var gameData = translator.Translate(gameInput);
board = boardFactory.GetBoard(gameData);
}
示例5: 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;
}
示例6: AfterEmit
public void AfterEmit(IEmitter emitter, ITranslator translator)
{
foreach (var plugin in this.Parts)
{
plugin.AfterEmit(emitter, translator);
}
}
示例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>();
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;
}
示例8: TranslatableException
public TranslatableException(Exception innerException, ITranslator translator, string format, params object[] args)
: base(null, innerException)
{
Format = format;
Args = args;
Translator = translator;
}
示例9: 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;
}
示例10: AlreadyTranslatedTranslator
public AlreadyTranslatedTranslator(ITranslator inner)
{
if (inner == null)
throw new ArgumentNullException("inner");
this.Inner = inner;
}
示例11: With
public NodeTreeParserConfig With(ITranslator translator)
{
this.translators.Add(translator);
this.locators.Add(new LinkedTextLocator(translator));
return this;
}
示例12: 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>();
IAgentInfoConnector users = DataManager.DataManager.RequestPlugin<IAgentInfoConnector>();
IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
GridWelcomeScreen welcomeInfo = connector.GetGeneric<GridWelcomeScreen>(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen");
if (welcomeInfo == null)
welcomeInfo = GridWelcomeScreen.Default;
IConfigSource config = webInterface.Registry.RequestModuleInterface<ISimulationBase>().ConfigSource;
vars.Add("GridStatus", translator.GetTranslatedString("GridStatus"));
vars.Add("GridOnline", welcomeInfo.GridStatus ? translator.GetTranslatedString("Online") : translator.GetTranslatedString("Offline"));
vars.Add("TotalUserCount", translator.GetTranslatedString("TotalUserCount"));
vars.Add("UserCount", webInterface.Registry.RequestModuleInterface<IUserAccountService>().
NumberOfUserAccounts(null, "").ToString());
vars.Add("TotalRegionCount", translator.GetTranslatedString("TotalRegionCount"));
vars.Add("RegionCount", DataManager.DataManager.RequestPlugin<IRegionData>().
Count((Framework.RegionFlags)0, (Framework.RegionFlags)0).ToString());
vars.Add("UniqueVisitors", translator.GetTranslatedString("UniqueVisitors"));
vars.Add("UniqueVisitorCount", users.RecentlyOnline((uint)TimeSpan.FromDays(30).TotalSeconds, false).ToString());
vars.Add("OnlineNow", translator.GetTranslatedString("OnlineNow"));
vars.Add("OnlineNowCount", users.RecentlyOnline(5 * 60, true).ToString());
vars.Add("HGActiveText", translator.GetTranslatedString("HyperGrid"));
string disabled = translator.GetTranslatedString("Disabled"),
enabled = translator.GetTranslatedString("Enabled");
vars.Add("HGActive", disabled + "(TODO: FIX)");
vars.Add("VoiceActiveLabel", translator.GetTranslatedString("Voice"));
vars.Add("VoiceActive", config.Configs["Voice"] != null && config.Configs["Voice"].GetString("Module", "GenericVoice") != "GenericVoice" ? enabled : disabled);
vars.Add("CurrencyActiveLabel", translator.GetTranslatedString("Currency"));
vars.Add("CurrencyActive", webInterface.Registry.RequestModuleInterface<IMoneyModule>() != null ? enabled : disabled);
return vars;
}
示例13: PluginsPresenter
/// <summary>
/// Initializes a new instance of the <see cref="PluginsPresenter" /> class.
/// </summary>
/// <param name="settingsService">The settings service.</param>
/// <param name="translator">The translator.</param>
public PluginsPresenter(
ISettingsService settingsService,
ITranslator<string, Plugins> translator)
{
this.settingsService = settingsService;
this.translator = translator;
}
示例14: ISOStringFieldEncoder
public ISOStringFieldEncoder(IPadder padder, IPrefix prefix, ITranslator translator)
: base()
{
_padder = padder;
_prefix = prefix;
_translator = translator;
}
示例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>();
// Tooltips Urls
vars.Add("TooltipsWelcomeScreen", translator.GetTranslatedString("TooltipsWelcomeScreen"));
vars.Add("TooltipsWorldMap", translator.GetTranslatedString("TooltipsWorldMap"));
// Index Page
vars.Add("HomeText", translator.GetTranslatedString("HomeText"));
vars.Add("HomeTextWelcome", translator.GetTranslatedString("HomeTextWelcome"));
vars.Add("HomeTextTips", translator.GetTranslatedString("HomeTextTips"));
vars.Add("WelcomeScreen", translator.GetTranslatedString("WelcomeScreen"));
vars.Add("WelcomeToText", translator.GetTranslatedString("WelcomeToText"));
IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
var settings = generics.GetGeneric<GridSettings>(UUID.Zero, "WebSettings", "Settings");
if (PagesMigrator.RequiresUpdate() && PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored))
vars.Add("PagesUpdateRequired", translator.GetTranslatedString("Pages") + " " + translator.GetTranslatedString("DefaultsUpdated"));
else
vars.Add("PagesUpdateRequired", "");
if (SettingsMigrator.RequiresUpdate() && SettingsMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastSettingsVersionUpdateIgnored))
vars.Add("SettingsUpdateRequired", translator.GetTranslatedString("Settings") + " " + translator.GetTranslatedString("DefaultsUpdated"));
else
vars.Add("SettingsUpdateRequired", "");
return vars;
}