当前位置: 首页>>代码示例>>C#>>正文


C# Localization类代码示例

本文整理汇总了C#中Localization的典型用法代码示例。如果您正苦于以下问题:C# Localization类的具体用法?C# Localization怎么用?C# Localization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Localization类属于命名空间,在下文中一共展示了Localization类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnLocalize

    /// <summary>
    /// This function is called by the Localization manager via a broadcast SendMessage.
    /// </summary>
    void OnLocalize(Localization loc)
    {
        if (mLanguage != loc.currentLanguage)
        {
            UIWidget w = GetComponent<UIWidget>();
            UILabel lbl = w as UILabel;
            UISprite sp = w as UISprite;

            // If no localization key has been specified, use the label's text as the key
            if (string.IsNullOrEmpty(mLanguage) && string.IsNullOrEmpty(key) && lbl != null) key = lbl.text;

            // If we still don't have a key, use the widget's name
            string val = string.IsNullOrEmpty(key) ? loc.Get(w.name) : loc.Get(key);

            if (lbl != null)
            {
                lbl.text = val;
            }
            else if (sp != null)
            {
                sp.spriteName = val;
                sp.MakePixelPerfect();
            }
            mLanguage = loc.currentLanguage;
        }
    }
开发者ID:rmkeezer,项目名称:fpsgame,代码行数:29,代码来源:UILocalize.cs

示例2: BuildEntityModel

        public virtual void BuildEntityModel(ref EntityModel entityModel, IComponentPresentation cp, Localization localization)
        {
            using (new Tracer(entityModel, cp, localization))
            {
                MvcData mvcData = GetMvcData(cp);
                Type modelType = ModelTypeRegistry.GetViewModelType(mvcData);

                // NOTE: not using ModelBuilderPipeline here, but directly calling our own implementation.
                BuildEntityModel(ref entityModel, cp.Component, modelType, localization);

                entityModel.XpmMetadata.Add("ComponentTemplateID", cp.ComponentTemplate.Id);
                entityModel.XpmMetadata.Add("ComponentTemplateModified", cp.ComponentTemplate.RevisionDate.ToString("yyyy-MM-ddTHH:mm:ss"));
                entityModel.XpmMetadata.Add("IsRepositoryPublished", cp.IsDynamic ? "true" : "false");
                entityModel.MvcData = mvcData;

                // add html classes to model from metadata
                // TODO: move to CreateViewModel so it can be merged with the same code for a Page/PageTemplate
                IComponentTemplate template = cp.ComponentTemplate;
                if (template.MetadataFields != null && template.MetadataFields.ContainsKey("htmlClasses"))
                {
                    // strip illegal characters to ensure valid html in the view (allow spaces for multiple classes)
                    entityModel.HtmlClasses = template.MetadataFields["htmlClasses"].Value.StripIllegalCharacters(@"[^\w\-\ ]");
                }

                if (cp.IsDynamic)
                {
                    // update Entity Identifier to that of a DCP
                    entityModel.Id = GetDxaIdentifierFromTcmUri(cp.Component.Id, cp.ComponentTemplate.Id);
                }
            }
        }
开发者ID:ginortoro,项目名称:dxa-web-application-dotnet,代码行数:31,代码来源:DefaultModelBuilder.cs

示例3: AddLocalization

        /// <summary>
        /// Add a localization file.
        /// </summary>
        /// <param name="localization">The localization file to add.</param>
        public void AddLocalization(Localization localization)
        {
            if (-1 == this.codepage)
            {
                this.codepage = localization.Codepage;
            }

            foreach (WixVariableRow wixVariableRow in localization.Variables)
            {
                WixVariableRow existingWixVariableRow = (WixVariableRow)this.variables[wixVariableRow.Id];

                if (null == existingWixVariableRow || (existingWixVariableRow.Overridable && !wixVariableRow.Overridable))
                {
                    this.variables[wixVariableRow.Id] = wixVariableRow;
                }
                else if (!wixVariableRow.Overridable)
                {
                    this.OnMessage(WixErrors.DuplicateLocalizationIdentifier(wixVariableRow.SourceLineNumbers, wixVariableRow.Id));
                }
            }

            foreach (KeyValuePair<string, LocalizedControl> localizedControl in localization.LocalizedControls)
            {
                if (!this.localizedControls.ContainsKey(localizedControl.Key))
                {
                    this.localizedControls.Add(localizedControl.Key, localizedControl.Value);
                }
            }
        }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:33,代码来源:Localizer.cs

示例4: DubizzleURIBuilder

 public DubizzleURIBuilder(HTTPProtocol protocol, Localization location, MainSection section)
 {
     Location = location ;
     Protocol = protocol;
     Section = section;
     this.Url = new Uri(string.Format("{0}{1}.{2}/{3}", _protocolString, _locationString, baseuri, _sectionString));
 }
开发者ID:rkrishnasanka,项目名称:Dubizzle,代码行数:7,代码来源:DubizzleURI.cs

示例5: OnLocalize

 private void OnLocalize(Localization loc)
 {
     if (this.mLanguage != loc.currentLanguage)
     {
         this.Localize();
     }
 }
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:7,代码来源:UILocalize.cs

示例6: Build

 public LocalizationViewModel Build(Localization localization)
 {
     return new LocalizationViewModel()
       {
     Culture = new CultureViewModelBuilder(this.handler).Build(localization.Culture),
     Value = localization.Value
       };
 }
开发者ID:blink2linkme,项目名称:Platformus,代码行数:8,代码来源:LocalizationViewModelBuilder.cs

示例7: App

		public App ()
		{
			InitializeComponent ();
			Localization = new Localization ();
			Preferences = DependencyService.Get<IPreferences> ();

			MainPage = new ContentPage ();
		}
开发者ID:arctouch-douglaskazumi,项目名称:ArcTouchPark,代码行数:8,代码来源:App.xaml.cs

示例8: Localize

 public string Localize(Localization.rowIds in_textID)
 {
     var row = Localization.Instance.GetRow(in_textID);
     if (row != null)
     {
         return row.GetStringData(EditorLanguage);
     }
     return "Unable to find string ID: " + in_textID;
 }
开发者ID:joenarus,项目名称:Stressident,代码行数:9,代码来源:Google2u.cs

示例9: GetCachedFile

        /// <summary>
        /// Gets the cached local file for a given URL path.
        /// </summary>
        /// <param name="urlPath">The URL path.</param>
        /// <param name="localization">The Localization.</param>
        /// <returns>The path to the local file.</returns>
        internal string GetCachedFile(string urlPath, Localization localization)
        {
            string localFilePath = GetFilePathFromUrl(urlPath, localization);
            using (new Tracer(urlPath, localization, localFilePath))
            {
                Dimensions dimensions;
                urlPath = StripDimensions(urlPath, out dimensions);
                int publicationId = Convert.ToInt32(localization.LocalizationId);

                DateTime lastPublishedDate = SiteConfiguration.CacheProvider.GetOrAdd(
                    urlPath,
                    CacheRegions.BinaryPublishDate,
                    () => GetBinaryLastPublishDate(urlPath, publicationId)
                    );

                if (lastPublishedDate != DateTime.MinValue)
                {
                    if (File.Exists(localFilePath))
                    {
                        if (localization.LastRefresh.CompareTo(lastPublishedDate) < 0)
                        {
                            //File has been modified since last application start but we don't care
                            Log.Debug("Binary with URL '{0}' is modified, but only since last application restart, so no action required", urlPath);
                            return localFilePath;
                        }
                        FileInfo fi = new FileInfo(localFilePath);
                        if (fi.Length > 0)
                        {
                            DateTime fileModifiedDate = File.GetLastWriteTime(localFilePath);
                            if (fileModifiedDate.CompareTo(lastPublishedDate) >= 0)
                            {
                                Log.Debug("Binary with URL '{0}' is still up to date, no action required", urlPath);
                                return localFilePath;
                            }
                        }
                    }
                }

                // Binary does not exist or cached binary is out-of-date
                BinaryMeta binaryMeta = GetBinaryMeta(urlPath, publicationId);
                if (binaryMeta == null)
                {
                    // Binary does not exist in Tridion, it should be removed from the local file system too
                    if (File.Exists(localFilePath))
                    {
                        CleanupLocalFile(localFilePath);
                    }
                    throw new DxaItemNotFoundException(urlPath, localization.LocalizationId);
                }
                BinaryFactory binaryFactory = new BinaryFactory();
                BinaryData binaryData = binaryFactory.GetBinary(publicationId, binaryMeta.Id, binaryMeta.VariantId);

                WriteBinaryToFile(binaryData.Bytes, localFilePath, dimensions);
                return localFilePath;
            }
        }
开发者ID:sdl,项目名称:dxa-web-application-dotnet,代码行数:62,代码来源:BinaryFileManager.cs

示例10: SetupParameters

        protected virtual NameValueCollection SetupParameters(SearchQuery searchQuery, Localization localization)
        {
            NameValueCollection result = new NameValueCollection(searchQuery.QueryStringParameters);
            result["fq"] = "publicationid:" + localization.LocalizationId;
            result["q"] = searchQuery.QueryText;
            result["start"] = searchQuery.Start.ToString(CultureInfo.InvariantCulture);
            result["rows"] = searchQuery.PageSize.ToString(CultureInfo.InvariantCulture);

            return result;
        }
开发者ID:RAJMITTAL,项目名称:dxa-modules,代码行数:10,代码来源:SI4TSearchProvider.cs

示例11: GetSearchIndexUrl

 protected virtual string GetSearchIndexUrl(Localization localization)
 {
     // First try the new search.queryURL setting provided by DXA 1.3 TBBs if the Search Query URL can be obtained from Topology Manager.
     string result = localization.GetConfigValue("search.queryURL");
     if (string.IsNullOrEmpty(result))
     {
         result = localization.GetConfigValue("search." + (localization.IsStaging ? "staging" : "live") + "IndexConfig");
     }
     return result;
 }
开发者ID:sdl,项目名称:dxa-modules,代码行数:10,代码来源:SI4TSearchProvider.cs

示例12: Start

    // Use this for initialization
    void Start()
    {
        m_Localization = DcGame.getInstance ().transform.FindChild ("Localization(Clone)").GetComponent (typeof(Localization)) as Localization;
        if (m_Localization == null){
            Debug.LogError("CAN'T FIND LOCALIZATION FILE");
        }
        //m_Localization.currentLanguage = "cn";

        m_IsInit = true;
    }
开发者ID:aminebenali,项目名称:dancing-cell-code,代码行数:11,代码来源:NvLocalizationManager.cs

示例13: Create

        /// <summary>
        /// Laedt das Formular zum Eintragen einer Trainingseinheit
        /// </summary>
        /// <param name="id">ID des Trainingsplans, fuer den die Trainingseinheit erstellt werden soll</param>
        /// <returns></returns>
        public ActionResult Create(int id)
        {
            RedirectIfNotLoggedIn();

            ml_WorkoutPlan model = _workoutService.Load(id);

            ILocalization loc = new Localization();
            ViewData["DateFormat"] = loc.GetjQueryDatepickerFormat();

            return View(model);
        }
开发者ID:m-boldt,项目名称:Exercise-Yourself,代码行数:16,代码来源:SessionController.cs

示例14: AddLocalization

 /// <summary>
 /// Add a localization file to this library.
 /// </summary>
 /// <param name="localization">The localization file to add.</param>
 public void AddLocalization(Localization localization)
 {
     if (!this.localizations.Contains(localization.Culture))
     {
         this.localizations.Add(localization.Culture, localization);
     }
     else
     {
         Localization existingCulture = (Localization)this.localizations[localization.Culture];
         existingCulture.Merge(localization);
     }
 }
开发者ID:zooba,项目名称:wix3,代码行数:16,代码来源:Library.cs

示例15: GetPrefix

 /// <summary>
 /// Gets prefix for semantic vocabulary.
 /// </summary>
 /// <param name="vocab">Vocabulary name</param>
 /// <param name="loc">The localization</param>
 /// <returns>Prefix for this semantic vocabulary</returns>
 public static string GetPrefix(string vocab, Localization loc)
 {
     string key = loc.LocalizationId;
     if (!_semanticVocabularies.ContainsKey(key) || SiteConfiguration.CheckSettingsNeedRefresh(_vocabSettingsType, loc))
     {
         LoadVocabulariesForLocalization(loc);
     }
     if (_semanticVocabularies.ContainsKey(key))
     {
         List<SemanticVocabulary> vocabs = _semanticVocabularies[key];
         return GetPrefix(vocabs, vocab);
     }
     Log.Error("Localization {0} does not contain vocabulary {1}. Check that the Publish Settings page is published and the application cache is up to date.", loc.LocalizationId, vocab);
     return null;
 }
开发者ID:tgfl-tom,项目名称:dxa-web-application-dotnet,代码行数:21,代码来源:SemanticMapping.cs


注:本文中的Localization类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。