本文整理汇总了C#中ITranslator类的典型用法代码示例。如果您正苦于以下问题:C# ITranslator类的具体用法?C# ITranslator怎么用?C# ITranslator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITranslator类属于命名空间,在下文中一共展示了ITranslator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:rjspence,项目名称:YourSim,代码行数:35,代码来源:edit_news.cs
示例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;
}
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:29,代码来源:factory_reset.cs
示例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;
}
开发者ID:VirtualReality,项目名称:Universe,代码行数:27,代码来源:sim_console.cs
示例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);
}
开发者ID:kevPo,项目名称:GameOfLife,代码行数:7,代码来源:GameOfLife.cs
示例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;
}
开发者ID:VirtualReality,项目名称:Universe,代码行数:27,代码来源:news_manager.cs
示例6: AfterEmit
public void AfterEmit(IEmitter emitter, ITranslator translator)
{
foreach (var plugin in this.Parts)
{
plugin.AfterEmit(emitter, translator);
}
}
开发者ID:GavinHwa,项目名称:Bridge,代码行数:7,代码来源:Plugins.cs
示例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;
}
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:33,代码来源:news.cs
示例8: TranslatableException
public TranslatableException(Exception innerException, ITranslator translator, string format, params object[] args)
: base(null, innerException)
{
Format = format;
Args = args;
Translator = translator;
}
开发者ID:happyu0223,项目名称:CodeFirstIOCDemo,代码行数:7,代码来源:TranslatableException.cs
示例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;
}
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:26,代码来源:add_news.cs
示例10: AlreadyTranslatedTranslator
public AlreadyTranslatedTranslator(ITranslator inner)
{
if (inner == null)
throw new ArgumentNullException("inner");
this.Inner = inner;
}
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:7,代码来源:ITranslator.cs
示例11: With
public NodeTreeParserConfig With(ITranslator translator)
{
this.translators.Add(translator);
this.locators.Add(new LinkedTextLocator(translator));
return this;
}
开发者ID:MatanShahar,项目名称:IntelliSun,代码行数:7,代码来源:NodeTreeParserConfig.cs
示例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;
}
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:35,代码来源:gridstatus.cs
示例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;
}
开发者ID:slodge,项目名称:NinjaCoderForMvvmCross,代码行数:12,代码来源:PluginsPresenter.cs
示例14: ISOStringFieldEncoder
public ISOStringFieldEncoder(IPadder padder, IPrefix prefix, ITranslator translator)
: base()
{
_padder = padder;
_prefix = prefix;
_translator = translator;
}
开发者ID:phucvinh,项目名称:iso4net,代码行数:7,代码来源:ISOStringFieldEncoder.cs
示例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;
}
开发者ID:rjspence,项目名称:YourSim,代码行数:29,代码来源:home.cs
示例16: GetPlugins
public static IPlugins GetPlugins(ITranslator translator, IAssemblyInfo config)
{
string path = null;
if (!string.IsNullOrWhiteSpace(config.PluginsPath))
{
path = Path.Combine(translator.FolderMode ? translator.Location : Path.GetDirectoryName(translator.Location), config.PluginsPath);
}
else
{
path = Path.Combine(translator.FolderMode ? translator.Location : Path.GetDirectoryName(translator.Location), "Bridge" + Path.DirectorySeparatorChar + "plugins");
}
if (!System.IO.Directory.Exists(path))
{
return new Plugins() { plugins = new IPlugin[0] };
}
DirectoryCatalog dirCatalog = new DirectoryCatalog(path, "*.dll");
var catalog = new AggregateCatalog(dirCatalog);
CompositionContainer container = new CompositionContainer(catalog);
var plugins = new Plugins();
container.ComposeParts(plugins);
return plugins;
}
开发者ID:txdv,项目名称:Builder,代码行数:26,代码来源:Plugins.cs
示例17: 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;
}
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:31,代码来源:webhelpers.cs
示例18: AfterOutput
public void AfterOutput(ITranslator translator, string outputPath, bool nocore)
{
foreach (var plugin in this.Parts)
{
plugin.AfterOutput(translator, outputPath, nocore);
}
}
开发者ID:GavinHwa,项目名称:Bridge,代码行数:7,代码来源:Plugins.cs
示例19: 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 = Framework.Utilities.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 = Framework.Utilities.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;
}
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:60,代码来源:online_users.cs
示例20: 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("DisplayLG1", "display: none;");
vars.Add("DisplayLG2", "display: none;");
vars.Add("DisplayLG3", "display: none;");
vars.Add("DisplayLG4", "display: none;");
vars.Add("DisplayLG5", "display: none;");
vars.Add("DisplayLG6", "display: none;");
if (translator.LanguageName == "en")
vars["DisplayLG1"] = "";
if (translator.LanguageName == "fr")
vars["DisplayLG2"] = "";
if (translator.LanguageName == "de")
vars["DisplayLG3"] = "";
if (translator.LanguageName == "it")
vars["DisplayLG4"] = "";
if (translator.LanguageName == "es")
vars["DisplayLG5"] = "";
if (translator.LanguageName == "nl")
vars["DisplayLG6"] = "";
return vars;
}
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:28,代码来源:index.cs
注:本文中的ITranslator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论