public IActionResult Code([FromBody] LangCode langCode)
        {
            try
            {
                if (langCode.Id == Guid.Empty)
                {
                    var foundLangCode = _unitOfWork.LanguageCodes.GetLanguageCode(langCode.LanguageCodeId);

                    if (foundLangCode == null)
                    {
                        var languageCode = _mapper.Map <LanguageCode>(langCode);

                        _unitOfWork.LanguageCodes.Add(languageCode);

                        _unitOfWork.Complete();

                        return(Created(new Uri($"{Request.Path}/Code/{languageCode.Id}", UriKind.Relative), _mapper.Map <LangItem>(languageCode)));
                    }
                }
            }
            catch (Exception e)
            {
                string message = e.Message;
            }

            return(BadRequest());
        }
Example #2
0
        private void InitLocalization()
        {
            LangCode currentLanguage = (LangCode)PlayerPrefs.GetInt(LanguageKey, (int)LangCode.EN);

            L10n.LoadLanguage(currentLanguage);
            L10n.LanguageLoaded += OnLanguageLoaded;
        }
Example #3
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            Shape? shape = null,
            Length[] coords = null,
            string href = null,
            NoHref? nohref = null,
            Target target = null,
            string alt = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            char? accesskey = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null
        )
        {
            Shape = shape;
            Coords = coords;
            Href = href;
            NoHref = nohref;
            Target = target;
            Alt = alt;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            AccessKey = accesskey;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;

            return this;
        }
Example #4
0
 public void SaveLanguage(LangCode code, Action onSuccess, Action <string> onError)
 {
     WrapErr.ToErrReport(9999, () => {
         ErrReport report;
         WrapErr.ToErrReport(out report, 9999, () => {
             this.languages.SetCurrentLanguage(code);
             SettingItems items = this.settings.ReadObjectFromDefaultFile();
             items.Language     = code;
             items.LanguageName = this.languages.CurrentLanguage.Language.Display;
             if (this.settings.WriteObjectToDefaultFile(items))
             {
                 onSuccess.Invoke();
             }
             else
             {
                 // TODO Language
                 onError.Invoke("Failed");
             }
         });
         if (report.Code != 0)
         {
             // TODO - language
             WrapErr.SafeAction(() => { onError.Invoke("Unhandled Error on saving language"); });
         }
     });
 }
Example #5
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string abbr = null,
            string axis = null,
            string headers = null,
            Scope? scope = null,
            int? rowspan = null,
            int? colspan = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            Align? align = null,
            char? @char = null,
            Length charoff = null,
            Valign? valign = null
        )
        {
            Abbr = abbr;
            Axis = axis;
            Headers = headers;
            Scope = scope;
            RowSpan = rowspan;
            ColSpan = colspan;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            Align = align;
            Char = @char;
            CharOff = charoff;
            Valign = valign;

            return this;
        }
Example #6
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                LangCode.ToBytes(),
                Keys.ToBytes()));
 }
Example #7
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            Shape?shape        = null,
            Length[] coords    = null,
            string href        = null,
            NoHref?nohref      = null,
            Target target      = null,
            string alt         = null,
            string id          = null,
            string @class      = null,
            string style       = null,
            string title       = null,
            LangCode lang      = null,
            string xmllang     = null,
            Dir?dir            = null,
            string onclick     = null,
            string ondblclick  = null,
            string onmousedown = null,
            string onmouseup   = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout  = null,
            string onkeypress  = null,
            string onkeydown   = null,
            string onkeyup     = null,
            char?accesskey     = null,
            int?tabindex       = null,
            string onfocus     = null,
            string onblur      = null
            )
        {
            Shape       = shape;
            Coords      = coords;
            Href        = href;
            NoHref      = nohref;
            Target      = target;
            Alt         = alt;
            Id          = id;
            Class       = @class;
            Style       = style;
            Title       = title;
            Lang        = lang;
            XmlLang     = xmllang;
            Dir         = dir;
            OnClick     = onclick;
            OnDblClick  = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp   = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut  = onmouseout;
            OnKeyPress  = onkeypress;
            OnKeyDown   = onkeydown;
            OnKeyUp     = onkeyup;
            AccessKey   = accesskey;
            TabIndex    = tabindex;
            OnFocus     = onfocus;
            OnBlur      = onblur;

            return(this);
        }
        public IActionResult Code(string id, [FromBody] JsonPatchDocument <LangCode> langCodePatch)
        {
            try
            {
                LanguageCode languageCode = _unitOfWork.LanguageCodes.GetLanguageCode(id, false);

                if (languageCode != null)
                {
                    LangCode langCode = _mapper.Map <LangCode>(languageCode);

                    langCodePatch.ApplyTo(langCode);

                    _mapper.Map(langCode, languageCode);

                    _unitOfWork.Complete();

                    return(CreatedAtRoute("Code", new { id = _mapper.Map <LangCode>(languageCode).Id }, _mapper.Map <LangCode>(languageCode)));
                }
            }
            catch (Exception e)
            {
                string message = e.Message;
            }

            return(BadRequest());
        }
Example #9
0
        public static void LoadLanguage(LangCode langCode)
        {
            if (Application.isPlaying)
            {
                SaveManager.Language = langCode;
            }

            var path = GetLocalizationFilePath(langCode);

            if (File.Exists(path))
            {
                string jsonLocalization = File.ReadAllText(path);
                CurrentLanguage = JsonUtility.FromJson <Language>(jsonLocalization);
                CurrentLanguage.LanguageCode = langCode;

                if (LanguageLoaded != null)
                {
                    LanguageLoaded();
                }
            }
            else
            {
                throw new LocalizationNotFoundException(langCode);
            }
        }
Example #10
0
    private void OnEnable()
    {
        string   language = EditorPrefs.GetString(LocalizationKey, LangCode.NA.ToString());
        LangCode langCode = (LangCode)Enum.Parse(typeof(LangCode), language);

        SetLanguage(langCode);
    }
Example #11
0
        public static void LoadLanguage(LangCode langCode)
        {
            var path = GetLocalizationFilePath(langCode);

            // The language exists
            if (File.Exists(path))
            {
                string jsonLanguage = File.ReadAllText(path);
                CurrentLanguage = JsonUtility.FromJson <Language>(jsonLanguage);

                if (LanguageLoaded != null)
                {
                    LanguageLoaded();
                }

                Debug.Log("Language loaded");
            }
            // The language we are trying to load does not exist
            else
            {
                CreateLanguage(langCode);

                //throw new LocalizationNotFoundException(langCode);
            }
        }
Example #12
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string abbr        = null,
            string axis        = null,
            string headers     = null,
            Scope?scope        = null,
            int?rowspan        = null,
            int?colspan        = null,
            string id          = null,
            string @class      = null,
            string style       = null,
            string title       = null,
            LangCode lang      = null,
            string xmllang     = null,
            Dir?dir            = null,
            string onclick     = null,
            string ondblclick  = null,
            string onmousedown = null,
            string onmouseup   = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout  = null,
            string onkeypress  = null,
            string onkeydown   = null,
            string onkeyup     = null,
            Align?align        = null,
            char? @char        = null,
            Length charoff     = null,
            Valign?valign      = null
            )
        {
            Abbr        = abbr;
            Axis        = axis;
            Headers     = headers;
            Scope       = scope;
            RowSpan     = rowspan;
            ColSpan     = colspan;
            Id          = id;
            Class       = @class;
            Style       = style;
            Title       = title;
            Lang        = lang;
            XmlLang     = xmllang;
            Dir         = dir;
            OnClick     = onclick;
            OnDblClick  = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp   = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut  = onmouseout;
            OnKeyPress  = onkeypress;
            OnKeyDown   = onkeydown;
            OnKeyUp     = onkeyup;
            Align       = align;
            Char        = @char;
            CharOff     = charoff;
            Valign      = valign;

            return(this);
        }
Example #13
0
        public async Task <IActionResult> OnGetAsync()
        {
            langCode = new LangCode();
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            await PageConstructor(SaveStates.IGNORE, accessToken);

            if (!string.IsNullOrWhiteSpace(Id))
            {
                var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.FOUNDATION, $"Language/Code/{Id}");

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    langCode = response.ContentAsType <LangCode>();
                }
            }

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Example #14
0
        public async Task Process_CommandMessage_SourceHasNotMetric(LangCode langCode, string content, StateType sourceState,
                                                                    MessageCode returnCode)
        {
            int    externalId = 1;
            string name       = "Koko";
            var    source     = new Source(externalId, name);

            source.UpdateState(sourceState);
            SourceRepoMock.Setup(r => r.FindOrCreateNew(externalId, name)).Returns(() => source);

            var message = new CommandUpdateMessage
            {
                ChatId       = externalId,
                Username     = name,
                Content      = content,
                LanguageCode = langCode,
            };

            await message.Accept(MessageProcessor);

            var localizer = new Localizer();
            var text      = localizer.GetMessage(langCode, returnCode);

            BotResponseMock.Verify(x => x.Response(text), Times.Once);
        }
 private void SaveIfDifferent(LangCode code)
 {
     if (this.languageOnEntry != code)
     {
         this.wrapper.SaveLanguage(code, App.ShowMsg);
     }
 }
 private void RevertIfDifferent(LangCode code)
 {
     if (this.languageOnEntry != code)
     {
         this.wrapper.SetLanguage(this.languageOnEntry);
     }
 }
Example #17
0
        private void OnEnable()
        {
            LangCode language = (LangCode)EditorPrefs.
                                GetInt(LocalizationKey, (int)LangCode.None);

            SetLanguage(language);
        }
Example #18
0
        private void OnGUI()
        {
            int currentIndex = 0;
            int startIndex   = _page * MaxEntriesPerPage;

            _lastPage = (_localizations.Count - 1) / MaxEntriesPerPage;

            LangCode langCode = (LangCode)EditorGUILayout.
                                EnumPopup(CurrentLanguage);

            SetLanguage(langCode);

            EditorGUILayout.BeginVertical();

            Dictionary <string, string> newValues =
                new Dictionary <string, string>();

            List <string> deletedKeys = new List <string>();

            foreach (var localization in _localizations)
            {
                // Separates entries to pages.
                // There's a maximum number of entries displayed
                // on each page but they are all still saved to JSON.
                if (currentIndex < startIndex ||
                    currentIndex >= startIndex + MaxEntriesPerPage)
                {
                    newValues.Add(localization.Key, localization.Value);
                    currentIndex++;
                    continue;
                }

                EditorGUILayout.BeginHorizontal();

                string key   = EditorGUILayout.TextField(localization.Key);
                string value = EditorGUILayout.TextField(localization.Value);

                newValues.Add(key, value);

                if (DeleteButtonPressed())
                {
                    deletedKeys.Add(localization.Key);
                }

                EditorGUILayout.EndHorizontal();

                currentIndex++;
            }

            _localizations = newValues;

            DeleteKeys(deletedKeys);

            AddValueButton();
            SaveButton();
            PageButtons();

            EditorGUILayout.EndVertical();
        }
Example #19
0
        public void SaveLanguage(LangCode code, Action <string> onError)
        {
            ErrReport report;

            WrapErr.ToErrReport(out report, 2000202, "Failure on SaveLanguage", () => {
                this.SaveLanguage(code, () => { }, onError);
            });
        }
Example #20
0
        /// <summary>
        /// Initializes localization.
        /// </summary>
        private void InitLocalization()
        {
            LangCode currentLang = _defaultLanguage;

            //(LangCode) PlayerPrefs.GetInt(LanguageKey, (int) _defaultLanguage);
            L10n.LoadLanguage(currentLang);
            L10n.LanguageLoaded += OnLanguageLoaded;
        }
Example #21
0
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     LangCode.ToStream(output);
     FromVersion.ToStream(output);
     Version.ToStream(output);
     Strings.ToStream(output);
 }
Example #22
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string action = null,
            Method? method = null,
            MimeType enctype = null,
            Target target = null,
            string onsubmit = null,
            string onreset = null,
            MimeType[] accept = null,
            Charset[] acceptcharset = null,
            string id = null,
            string name = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Action = action;
            Method = method;
            EncType = enctype;
            Target = target;
            OnSubmit = onsubmit;
            OnReset = onreset;
            Accept = accept;
            AcceptCharset = acceptcharset;
            Id = id;
            Name = name;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     AppId.ToStream(output);
     DeviceModel.ToStream(output);
     SystemVersion.ToStream(output);
     AppVersion.ToStream(output);
     LangCode.ToStream(output);
 }
Example #24
0
 public void SetLanguage(LangCode code)
 {
     WrapErr.ToErrReport(9999, () => {
         ErrReport report;
         WrapErr.ToErrReport(out report, 9999, () => {
             this.languages.SetCurrentLanguage(code);
         });
     });
 }
Example #25
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name        = null,
            int?size           = null,
            Multiple?multiple  = null,
            Disabled?disabled  = null,
            int?tabindex       = null,
            string onfocus     = null,
            string onblur      = null,
            string onchange    = null,
            string id          = null,
            string @class      = null,
            string style       = null,
            string title       = null,
            LangCode lang      = null,
            string xmllang     = null,
            Dir?dir            = null,
            string onclick     = null,
            string ondblclick  = null,
            string onmousedown = null,
            string onmouseup   = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout  = null,
            string onkeypress  = null,
            string onkeydown   = null,
            string onkeyup     = null
            )
        {
            Name        = name;
            Size        = size;
            Multiple    = multiple;
            Disabled    = disabled;
            TabIndex    = tabindex;
            OnFocus     = onfocus;
            OnBlur      = onblur;
            OnChange    = onchange;
            Id          = id;
            Class       = @class;
            Style       = style;
            Title       = title;
            Lang        = lang;
            XmlLang     = xmllang;
            Dir         = dir;
            OnClick     = onclick;
            OnDblClick  = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp   = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut  = onmouseout;
            OnKeyPress  = onkeypress;
            OnKeyDown   = onkeydown;
            OnKeyUp     = onkeyup;

            return(this);
        }
Example #26
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name = null,
            string value = null,
            ButtonType? type = null,
            Disabled? disabled = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            char? accesskey = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null
        )
        {
            Name = name;
            Value = value;
            Type = type;
            Disabled = disabled;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            AccessKey = accesskey;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;

            return this;
        }
Example #27
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string src         = null,
            string alt         = null,
            string longdesc    = null,
            Length height      = null,
            Length width       = null,
            string usemap      = null,
            IsMap?ismap        = null,
            string id          = null,
            string name        = null,
            string @class      = null,
            string style       = null,
            string title       = null,
            LangCode lang      = null,
            string xmllang     = null,
            Dir?dir            = null,
            string onclick     = null,
            string ondblclick  = null,
            string onmousedown = null,
            string onmouseup   = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout  = null,
            string onkeypress  = null,
            string onkeydown   = null,
            string onkeyup     = null
            )
        {
            Src         = src;
            Alt         = alt;
            LongDesc    = longdesc;
            Height      = height;
            Width       = width;
            UseMap      = usemap;
            IsMap       = ismap;
            Id          = id;
            Name        = name;
            Class       = @class;
            Style       = style;
            Title       = title;
            Lang        = lang;
            XmlLang     = xmllang;
            Dir         = dir;
            OnClick     = onclick;
            OnDblClick  = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp   = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut  = onmouseout;
            OnKeyPress  = onkeypress;
            OnKeyDown   = onkeydown;
            OnKeyUp     = onkeyup;

            return(this);
        }
Example #28
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string src = null,
            string alt = null,
            string longdesc = null,
            Length height = null,
            Length width = null,
            string usemap = null,
            IsMap? ismap = null,
            string id = null,
            string name = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Src = src;
            Alt = alt;
            LongDesc = longdesc;
            Height = height;
            Width = width;
            UseMap = usemap;
            IsMap = ismap;
            Id = id;
            Name = name;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Example #29
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name = null,
            int? size = null,
            Multiple? multiple = null,
            Disabled? disabled = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null,
            string onchange = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Name = name;
            Size = size;
            Multiple = multiple;
            Disabled = disabled;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;
            OnChange = onchange;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Example #30
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            Charset charset = null,
            string href = null,
            LangCode hreflang = null,
            Target target = null,
            MimeType type = null,
            LinkType? rel = null,
            LinkType? rev = null,
            Media? media = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Charset = charset;
            Href = href;
            HrefLang = hreflang;
            Target = target;
            Type = type;
            Rel = rel;
            Rev = rev;
            Media = media;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Example #31
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            Charset charset    = null,
            string href        = null,
            LangCode hreflang  = null,
            Target target      = null,
            MimeType type      = null,
            LinkType?rel       = null,
            LinkType?rev       = null,
            Media?media        = null,
            string id          = null,
            string @class      = null,
            string style       = null,
            string title       = null,
            LangCode lang      = null,
            string xmllang     = null,
            Dir?dir            = null,
            string onclick     = null,
            string ondblclick  = null,
            string onmousedown = null,
            string onmouseup   = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout  = null,
            string onkeypress  = null,
            string onkeydown   = null,
            string onkeyup     = null
            )
        {
            Charset     = charset;
            Href        = href;
            HrefLang    = hreflang;
            Target      = target;
            Type        = type;
            Rel         = rel;
            Rev         = rev;
            Media       = media;
            Id          = id;
            Class       = @class;
            Style       = style;
            Title       = title;
            Lang        = lang;
            XmlLang     = xmllang;
            Dir         = dir;
            OnClick     = onclick;
            OnDblClick  = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp   = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut  = onmouseout;
            OnKeyPress  = onkeypress;
            OnKeyDown   = onkeydown;
            OnKeyUp     = onkeyup;

            return(this);
        }
Example #32
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name        = null,
            string value       = null,
            ButtonType?type    = null,
            Disabled?disabled  = null,
            string id          = null,
            string @class      = null,
            string style       = null,
            string title       = null,
            LangCode lang      = null,
            string xmllang     = null,
            Dir?dir            = null,
            string onclick     = null,
            string ondblclick  = null,
            string onmousedown = null,
            string onmouseup   = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout  = null,
            string onkeypress  = null,
            string onkeydown   = null,
            string onkeyup     = null,
            char?accesskey     = null,
            int?tabindex       = null,
            string onfocus     = null,
            string onblur      = null
            )
        {
            Name        = name;
            Value       = value;
            Type        = type;
            Disabled    = disabled;
            Id          = id;
            Class       = @class;
            Style       = style;
            Title       = title;
            Lang        = lang;
            XmlLang     = xmllang;
            Dir         = dir;
            OnClick     = onclick;
            OnDblClick  = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp   = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut  = onmouseout;
            OnKeyPress  = onkeypress;
            OnKeyDown   = onkeydown;
            OnKeyUp     = onkeyup;
            AccessKey   = accesskey;
            TabIndex    = tabindex;
            OnFocus     = onfocus;
            OnBlur      = onblur;

            return(this);
        }
Example #33
0
 /// <summary>
 /// Sets new locale to I18NPortable
 /// </summary>
 /// <param name="locale">new locale code</param>
 /// <returns>false if locale already set</returns>
 public bool SetLang(string locale)
 {
     if (LangCode.Equals(locale))
     {
         return(false);
     }
     I18N.Current.Locale = locale;
     SaveLocale(locale);
     return(true);
 }
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                AppId.ToBytes(),
                DeviceModel.ToBytes(),
                SystemVersion.ToBytes(),
                AppVersion.ToBytes(),
                LangCode.ToBytes(),
                Data.ToBytes()));
 }
 private void OnLanguageLoaded(LangCode currentLang)
 {
     if (!_resolved)
     {
         SetScore(_currentScore);
     }
     else
     {
         YouWin();
     }
 }
Example #36
0
        private void OnGUI()
        {
            LangCode langCode =
                (LangCode)EditorGUILayout.EnumPopup(CurrentLanguage);

            SetLanguage(langCode);

            EditorGUILayout.BeginVertical();

            Dictionary <string, string> newValues =
                new Dictionary <string, string>();
            List <string> deletedKeys = new List <string>();

            foreach (var localization in _localizations)
            {
                EditorGUILayout.BeginHorizontal();
                string key   = EditorGUILayout.TextField(localization.Key);
                string value = EditorGUILayout.TextField(localization.Value);

                newValues.Add(key, value);

                if (GUILayout.Button("X"))
                {
                    deletedKeys.Add(localization.Key);
                }

                EditorGUILayout.EndHorizontal();
            }

            _localizations = newValues;
            foreach (var deletedKey in deletedKeys)
            {
                if (_localizations.ContainsKey(deletedKey))
                {
                    _localizations.Remove(deletedKey);
                }
            }

            if (GUILayout.Button("Add value"))
            {
                if (!_localizations.ContainsKey(""))
                {
                    _localizations.Add("", "");
                }
            }

            if (GUILayout.Button("Save"))
            {
                l10n.CurrentLanguage.SetValues(_localizations);
                l10n.SaveCurrentLanguage();
            }

            EditorGUILayout.EndVertical();
        }
Example #37
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string summary     = null,
            Length width       = null,
            int?border         = null,
            Frame?frame        = null,
            Rules?rules        = null,
            Length cellspacing = null,
            Length cellpadding = null,
            string id          = null,
            string @class      = null,
            string style       = null,
            string title       = null,
            LangCode lang      = null,
            string xmllang     = null,
            Dir?dir            = null,
            string onclick     = null,
            string ondblclick  = null,
            string onmousedown = null,
            string onmouseup   = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout  = null,
            string onkeypress  = null,
            string onkeydown   = null,
            string onkeyup     = null
            )
        {
            Summary     = summary;
            Width       = width;
            Border      = border;
            Frame       = frame;
            Rules       = rules;
            CellSpacing = cellspacing;
            CellPadding = cellpadding;
            Id          = id;
            Class       = @class;
            Style       = style;
            Title       = title;
            Lang        = lang;
            XmlLang     = xmllang;
            Dir         = dir;
            OnClick     = onclick;
            OnDblClick  = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp   = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut  = onmouseout;
            OnKeyPress  = onkeypress;
            OnKeyDown   = onkeydown;
            OnKeyUp     = onkeyup;

            return(this);
        }
Example #38
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string summary = null,
            Length width = null,
            int? border = null,
            Frame? frame = null,
            Rules? rules = null,
            Length cellspacing = null,
            Length cellpadding = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Summary = summary;
            Width = width;
            Border = border;
            Frame = frame;
            Rules = rules;
            CellSpacing = cellspacing;
            CellPadding = cellpadding;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Example #39
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null
        )
        {
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;

            return this;
        }
Example #40
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            int? span = null,
            MultiLength width = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            Align? align = null,
            char? @char = null,
            Length charoff = null,
            Valign? valign = null
        )
        {
            Span = span;
            Width = width;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            Align = align;
            Char = @char;
            CharOff = charoff;
            Valign = valign;

            return this;
        }
Example #41
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string profile = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null
        )
        {
            Profile = profile;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;

            return this;
        }
Example #42
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string @for = null,
            char? accesskey = null,
            string onfocus = null,
            string onblur = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            For = @for;
            AccessKey = accesskey;
            OnFocus = onfocus;
            OnBlur = onblur;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Example #43
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            Selected? selected = null,
            Disabled? disabled = null,
            string label = null,
            string value = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Selected = selected;
            Disabled = disabled;
            Label = label;
            Value = value;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Example #44
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string cite = null,
            DateTime? datetime = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Cite = cite;
            DateTime = datetime;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Example #45
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            HttpEquiv httpequiv = null,
            MetaName name = null,
            string content = null,
            string scheme = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null
        )
        {
            HttpEquiv = httpequiv;
            Name = name;
            Content = content;
            Scheme = scheme;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;

            return this;
        }
Example #46
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null
        )
        {
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;

            return this;
        }
Example #47
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            MimeType type = null,
            Media? media = null,
            string title = null,
            string xmlspace = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null
        )
        {
            Type = type;
            Media = media;
            Title = title;
            XmlSpace = xmlspace;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;

            return this;
        }
Example #48
0
 public static TagInput lang(this TagInput tag, LangCode value) { tag.Lang = value; return tag; }
Example #49
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name = null,
            int? rows = null,
            int? cols = null,
            Disabled? disabled = null,
            ReadOnly? @readonly = null,
            string onselect = null,
            string onchange = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            char? accesskey = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null
        )
        {
            Name = name;
            Rows = rows;
            Cols = cols;
            Disabled = disabled;
            ReadOnly = @readonly;
            OnSelect = onselect;
            OnChange = onchange;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            AccessKey = accesskey;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;

            return this;
        }
Example #50
0
 public static TagTable lang(this TagTable tag, LangCode value) { tag.Lang = value; return tag; }
Example #51
0
 public static TagStrong lang(this TagStrong tag, LangCode value) { tag.Lang = value; return tag; }
Example #52
0
 public static TagTextArea lang(this TagTextArea tag, LangCode value) { tag.Lang = value; return tag; }
Example #53
0
 public static TagColGroup lang(this TagColGroup tag, LangCode value) { tag.Lang = value; return tag; }
Example #54
0
 public static TagThead lang(this TagThead tag, LangCode value) { tag.Lang = value; return tag; }
Example #55
0
 public static TagLabel lang(this TagLabel tag, LangCode value) { tag.Lang = value; return tag; }
Example #56
0
 public static TagA hreflang(this TagA tag, LangCode value) { tag.HrefLang = value; return tag; }
Example #57
0
 public static TagObject lang(this TagObject tag, LangCode value) { tag.Lang = value; return tag; }
Example #58
0
 public static TagCaption lang(this TagCaption tag, LangCode value) { tag.Lang = value; return tag; }
Example #59
0
 public static TagHr lang(this TagHr tag, LangCode value) { tag.Lang = value; return tag; }
Example #60
0
 public static TagAddress lang(this TagAddress tag, LangCode value) { tag.Lang = value; return tag; }