Esempio n. 1
1
 public District(DistrictTypes type, Byte id, LanguageCodes langCode = LanguageCodes.EN)
 {
     _type = type;
     _lang = langCode;
     Type = (Byte)((Byte)type + (Byte)langCode);
     Id = id;
 }
        private async Task UpdateJumpList()
        {
            if (!JumpList.IsSupported())
            {
                return;
            }

            try
            {
                JumpList jumpList = await JumpList.LoadCurrentAsync();

                jumpList.SystemGroupKind = JumpListSystemGroupKind.None;
                jumpList.Items.Clear();

                foreach (DirectionViewModel directionViewModel in AvailableDirections)
                {
                    string itemName  = string.Format("{0} → {1}", directionViewModel.OriginLanguage, directionViewModel.DestinationLanguage);
                    string arguments = "dict:" + directionViewModel.OriginLanguageCode + directionViewModel.DestinationLanguageCode;

                    JumpListItem jumpListItem = JumpListItem.CreateWithArguments(arguments, itemName);

                    jumpListItem.Logo = LanguageCodes.GetCountryFlagUri(directionViewModel.OriginLanguageCode);

                    jumpList.Items.Add(jumpListItem);
                }

                await jumpList.SaveAsync();
            }
            catch
            {
                // in rare cases, SaveAsync may fail with HRESULT 0x80070497: "Unable to remove the file to be replaced."
                // this appears to be a common problem without a solution, so we simply ignore any errors here
            }
        }
Esempio n. 3
0
        /// <summary>
        /// The user clicked on an item in the list of languages and strings.
        /// </summary>
        private void LstWallLanguages_MouseClick(object sender, MouseEventArgs e)
        {
            LblWallPrice.Visible = true;
            LblWallName.Visible  = true;

            //A floor or wall has only 1 string table.
            STR StringTable = m_CurrentIff.StringTables[0];

            foreach (ListViewItem Item in LstWallLanguages.Items)
            {
                //We only support selecting one item at a time.
                if (Item.Selected)
                {
                    TxtWallName.Visible = true;
                    TxtWallName.Clear();

                    TxtWallPrice.Visible = true;
                    TxtWallPrice.Clear();

                    TxtWallStrings.Visible = true;
                    TxtWallStrings.Clear();

                    LanguageCodes SelectedCode = (LanguageCodes)Enum.Parse(typeof(LanguageCodes), Item.Text);
                    m_CurrentLanguage   = SelectedCode;
                    TxtWallName.Text    = StringTable.GetString(SelectedCode, ObjectStringIndices.Name);
                    TxtWallPrice.Text   = StringTable.GetString(SelectedCode, ObjectStringIndices.Price);
                    TxtWallStrings.Text = StringTable.GetString(SelectedCode, ObjectStringIndices.Description);
                }
            }
        }
Esempio n. 4
0
        public async Task <string?> GetTranslationAsync(LanguageCodes languageCode,
                                                        TelegramTranslationKeys telegramTranslationKey,
                                                        bool omitCache          = false,
                                                        CancellationToken token = default)
        {
            const double timeoutDays = 1;
            var          key         = string.Format(TranslationCacheKeyFormat, languageCode, telegramTranslationKey);

            if (memoryCache.TryGetValue <string>(key,
                                                 out var result))
            {
                return(result);
            }

            var translation = await PolicySet.ReadPolicy
                              .ExecuteAsync(() => Context.TelegramTranslations
                                            .FirstOrDefaultAsync(x
                                                                 => x.Language == languageCode &&
                                                                 x.Key == telegramTranslationKey, token));

            var value = translation?.Value;

            if (!string.IsNullOrEmpty(value))
            {
                memoryCache.Set(key, value, new MemoryCacheEntryOptions
                {
                    SlidingExpiration = TimeSpan.FromDays(timeoutDays)
                });
            }

            return(value);
        }
Esempio n. 5
0
 public District(DistrictTypes type, byte id, LanguageCodes langCode = LanguageCodes.EN)
 {
     _type = type;
     _lang = langCode;
     Type  = (byte)((byte)type + (byte)langCode);
     Id    = id;
 }
Esempio n. 6
0
            public static void SaveStrings()
            {
                foreach (KeyValuePair <string, LocalisationMap> languagePair in _localisationMaps)
                {
                    SystemLanguage languageCode = LanguageCodes.GetLanguageFromCode(languagePair.Key);

                    if (languageCode != SystemLanguage.Unknown)
                    {
                        string resourceName = GetLocalisationMapName(languageCode);
                        string assetsPath   = LocalisationProjectSettings.Get()._localisationFolder;
                        string resourcePath = AssetUtils.GetResourcePath(assetsPath) + "/" + resourceName;
                        string filePath     = AssetUtils.GetAppllicationPath();

                        TextAsset asset = Resources.Load(resourcePath) as TextAsset;
                        if (asset != null)
                        {
                            filePath += AssetDatabase.GetAssetPath(asset);
                        }
                        else
                        {
                            filePath += assetsPath + "/" + resourceName + ".xml";
                        }

                        languagePair.Value._language = LanguageCodes.GetLanguageFromCode(languagePair.Key);
                        languagePair.Value.SortStrings();

                        Serializer.ToFile(languagePair.Value, filePath);
                    }
                }

                _dirty = false;
            }
Esempio n. 7
0
            public string GetString(string key, SystemLanguage language, SystemLanguage fallBackLanguage)
            {
                string text;
                Dictionary <string, string> localisedString;

                if (!string.IsNullOrEmpty(key) && _strings.TryGetValue(key, out localisedString))
                {
                    if (localisedString.TryGetValue(LanguageCodes.GetLanguageCode(language), out text))
                    {
                        return(text);
                    }
                    else
                    {
                        Debug.Log("Can't find localised version of string " + key + " for " + language);
#if _DEBUG
                        if (fallBackLanguage != SystemLanguage.Unknown && fallBackLanguage != language &&
                            localisedString.TryGetValue(LanguageCodes.GetLanguageCode(fallBackLanguage), out text))
                        {
                            return(text);
                        }
                        else
                        {
                            Debug.Log("Can't find localised version of string " + key);
                        }
#endif
                    }
                }

                return(string.Empty);
            }
Esempio n. 8
0
		/// <summary>
		/// This function sets the current UI culture and resource manager
		/// </summary>
		/// <param name="lngCode">LanguageCode</param>
		/// <returns>True or False.</returns>
		static internal bool SetLanguage(LanguageCodes lngCode)
		{
			try
			{
				string languageCulture;
				if (lngCode == LanguageCodes.English)
				{
					m_ResourceManager = new ResourceManager(Constants.RESOURCE_NAME, typeof(ViewBase).Assembly);
					languageCulture = Common.Constants.ENGLISH_CULTURE;
				}
				else if (lngCode == LanguageCodes.Japanese)
				{
					m_ResourceManager = new ResourceManager(Constants.RESOURCE_NAME_JP, typeof(ViewBase).Assembly);
					languageCulture = Common.Constants.JAPANESE_CULTURE;
				}
				else
				{
					m_ResourceManager = new ResourceManager(Constants.RESOURCE_NAME, typeof(ViewBase).Assembly);
					languageCulture = Common.Constants.ENGLISH_CULTURE;
				}

				const bool languageStatus = true;
				m_SelectedLanguage = lngCode;
				return languageStatus;
			}
			catch (Exception)
			{
				return false;
			}
		}//End of the function SetLnaguage.
Esempio n. 9
0
 private static void MakeSureStringsAreLoaded(SystemLanguage language)
 {
     if (!_localisationMaps.ContainsKey(LanguageCodes.GetLanguageCode(language)))
     {
         LoadStrings(language);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// This function sets the current UI culture and resource manager
        /// </summary>
        /// <param name="lngCode">LanguageCode</param>
        /// <returns>True or False.</returns>
        static internal bool SetLanguage(LanguageCodes lngCode)
        {
            try
            {
                string languageCulture;
                if (lngCode == LanguageCodes.English)
                {
                    m_ResourceManager = new ResourceManager(Constants.RESOURCE_NAME, typeof(ViewBase).Assembly);
                    languageCulture   = Common.Constants.ENGLISH_CULTURE;
                }
                else if (lngCode == LanguageCodes.Japanese)
                {
                    //not included.
                    m_ResourceManager = new ResourceManager(Constants.RESOURCE_NAME_JP, typeof(ViewBase).Assembly);
                    languageCulture   = Common.Constants.JAPANESE_CULTURE;
                }
                else
                {
                    m_ResourceManager = new ResourceManager(Constants.RESOURCE_NAME, typeof(ViewBase).Assembly);
                    languageCulture   = Common.Constants.ENGLISH_CULTURE;
                }

                const bool languageStatus = true;
                m_SelectedLanguage = lngCode;
                return(languageStatus);
            }
            catch (Exception)
            {
                return(false);
            }
        }        //End of the function SetLnaguage.
Esempio n. 11
0
            public static void Set(string key, SystemLanguage language, string text)
            {
                OnPreEditorChange();

                _localisationMaps[LanguageCodes.GetLanguageCode(language)].SetString(key, text);

                OnPostEditorChange();
            }
Esempio n. 12
0
        private void OnTranslatedWord(LanguageCodes target, string targetText, string sourceText)
        {
            WordTranslation wordT = new WordTranslation();

            wordT.country = (Languages)target;
            wordT.meaning = targetText;
            db.GetDB().Find(x => x.word.Equals(sourceText)).wordTranslation.Add(wordT);
        }
Esempio n. 13
0
        public static int GetLanguageIdFromLanguageEnum(LanguageCodes pLanguageCode)
        {
            if (Enum.IsDefined(typeof(LanguageCodes), pLanguageCode) == false)
            {
                return(-1);
            }

            return((int)pLanguageCode);
        }
Esempio n. 14
0
        public static string Type2Text(LanguageCodes value)
        {
            switch (value)
            {
            case LanguageCodes.VI: return(Languages.Libs.GetString("vietnamese"));

            default: return(Languages.Libs.GetString("english"));
            }
        }
Esempio n. 15
0
            public static string Get(string key, SystemLanguage language, params LocalisationLocalVariable[] localVariables)
            {
                MakeSureStringsAreLoaded(language);

                string text = _localisationMaps[LanguageCodes.GetLanguageCode(language)].Get(key);

                text = ReplaceVariables(text, localVariables);

                return(text);
            }
Esempio n. 16
0
            public static void UnloadStrings(SystemLanguage language)
            {
                if (_localisationMaps.ContainsKey(LanguageCodes.GetLanguageCode(language)))
                {
#if UNITY_EDITOR
                    EditorWarnIfDirty();
#endif
                    _localisationMaps.Remove(LanguageCodes.GetLanguageCode(language));
                }
            }
Esempio n. 17
0
 /// <summary>
 /// Gets a specific string for a specified language code.
 /// </summary>
 /// <param name="LangCode">The language code.</param>
 /// <param name="Index">The index of the string to retrieve.</param>
 /// <returns>A string.</returns>
 public string GetString(LanguageCodes LangCode, ObjectStringIndices Index)
 {
     try
     {
         return(Strings[LangCode][(int)Index].TranslatedStr);
     }
     catch (Exception)
     {
         return("");
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Returns a list of strings for a specified language code.
 /// </summary>
 /// <param name="LangCode">The language code to retrieve strings for.</param>
 /// <returns>A list of strings for the specified language code.</returns>
 public List <TranslatedString> GetStringList(LanguageCodes LangCode)
 {
     if (Strings.ContainsKey(LangCode))
     {
         return(Strings[LangCode]);
     }
     else
     {
         return(new List <TranslatedString>());
     }
 }
Esempio n. 19
0
            public static string GetRawString(string key, SystemLanguage language)
            {
                MakeSureStringsAreLoaded(language);

                if (_localisationMaps.TryGetValue(LanguageCodes.GetLanguageCode(language), out LocalisationMap map))
                {
                    return(map.Get(key, true));
                }

                return(string.Empty);
            }
Esempio n. 20
0
 public static LanguageCodes FromString(this LanguageCodes _c, string s)
 {
     try
     {
         return((LanguageCodes)Enum.Parse(typeof(LanguageCodes), s.ToUpper()));
     }
     catch
     {
         return(LanguageCodes.Unknown);
     }
 } // !FromString()
Esempio n. 21
0
            public static bool Exists(string key, SystemLanguage language)
            {
                MakeSureStringsAreLoaded();

                if (_localisationMaps.TryGetValue(LanguageCodes.GetLanguageCode(language), out LocalisationMap map))
                {
                    return(map.IsValidKey(key));
                }

                return(false);
            }
Esempio n. 22
0
        public static async void UpdatePreferedLanguageByIDAsync(string Accountname,
                                                                 LanguageCodes ID)
        {
            using (var Cmd = new SQLiteCommand())
            {
                Cmd.Connection  = m_DBConnection;
                Cmd.CommandText = "UPDATE Accounts SET PreferedLanguageID = " + (int)ID +
                                  " WHERE Username = '******'";
                Cmd.CommandType = CommandType.Text;

                await Cmd.ExecuteReaderAsync();
            }
        }
Esempio n. 23
0
            public static string Get(SystemLanguage language, string key, params LocalisationLocalVariable[] localVariables)
            {
                MakeSureStringsAreLoaded(language);

                if (_localisationMaps.TryGetValue(LanguageCodes.GetLanguageCode(language), out LocalisationMap map))
                {
                    string text = map.Get(key);
                    text = ReplaceVariables(text, localVariables);

                    return(text);
                }

                return("No Localisation Map found for " + language);
            }
Esempio n. 24
0
        private void FreshChapterView()
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(FreshChapterView));
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            try
            {
                listChapters.Items.Clear();
                //fill list
                foreach (ChapterEntry c in pgc.Chapters)
                {
                    //don't show short last chapter depending on settings
                    if (pgc.Duration != TimeSpan.Zero && miIgnoreShortLastChapter.Checked &&
                        c.Equals(pgc.Chapters.Last()) && (pgc.Duration.Add(-c.Time).TotalSeconds <
                                                          Settings.Default.ShortChapterSeconds))
                    {
                        continue;
                    }

                    listChapters.Items.Add(new ListViewItem(new string[] { c.Time.ToShortString(), c.Name }));
                }
                if (intIndex < listChapters.Items.Count && listChapters.Items[intIndex] != null)
                {
                    //select it
                    listChapters.Items[intIndex].Selected = true;
                    //scroll to it
                    listChapters.Items[intIndex].EnsureVisible();
                }

                //update status
                tsslDuration.Text = "Duration: " + pgc.Duration.ToShortString();
                tsslFps.Text      = pgc.FramesPerSecond.ToString("0.000") + "fps";
                tsslLang.Text     = pgc.LangCode + " (" + LanguageCodes.GetName(pgc.LangCode) + ")";
                tsslStatus.Text   = "Chapters loaded.";

                //check the current fps
                foreach (MenuItem mi in menuCurrentFps.MenuItems)
                {
                    double fps = Convert.ToDouble(mi.Text, new NumberFormatInfo());
                    mi.Checked = (Math.Round(fps, 3) == Math.Round(pgc.FramesPerSecond, 3));
                }
            }
            catch (Exception ex) { Trace.WriteLine(ex); }
            finally { this.Cursor = Cursors.Default; }
        }
Esempio n. 25
0
 void LoadLangMenu()
 {
     menuLang.MenuItems.Clear();
     foreach (KeyValuePair <string, string> lang in LanguageCodes.GetLanguages()
              .Where(kvp => Settings.Default.LangValues.Contains(kvp.Key)).Concat(
                  LanguageCodes.GetLanguages().Where(u => u.Key == "und")))
     {
         menuLang.MenuItems.Add(new MenuItem(lang.Key + " (" + lang.Value + ")",
                                             (s, args) => ChangeLang(((MenuItem)s).Tag as string))
         {
             Tag        = lang.Key,
             RadioCheck = true,
             Checked    = lang.Key == (pgc == null ? Settings.Default.DefaultLangCode : pgc.LangCode)
         });
     }
     menuLang.MenuItems.Add(menuLang.MenuItems.Count - 1, new MenuItem("-"));
 }
Esempio n. 26
0
            public void UpdateString(string key, SystemLanguage language, string text)
            {
                if (!string.IsNullOrEmpty(key))
                {
                    Dictionary <string, string> localisedString;

                    if (_strings.TryGetValue(key, out localisedString))
                    {
                        localisedString[LanguageCodes.GetLanguageCode(language)] = text;
                    }
                    else
                    {
                        _strings.Add(key, new Dictionary <string, string>());
                        _strings[key].Add(LanguageCodes.GetLanguageCode(language), text);
                    }
                }
            }
Esempio n. 27
0
            public static void ReloadStrings(bool warnIfDirty = false)
            {
                if (warnIfDirty)
                {
                    EditorWarnIfDirty();
                }

                string[] languageCodes = new string[_localisationMaps.Keys.Count];
                _localisationMaps.Keys.CopyTo(languageCodes, 0);

                foreach (string languageCode in languageCodes)
                {
                    SystemLanguage language = LanguageCodes.GetLanguageFromCode(languageCode);
                    LoadStrings(language);
                }

                _dirty = false;
            }
Esempio n. 28
0
        private IEnumerator Process(LanguageCodes sourceLang, List <LanguageCodes> targetLang, string sourceText)
        {
            string sourcText = sourceLang.ToString();
            bool   isError   = false;

            Debug.Log("Word" + " : " + sourceText);
            foreach (var val in targetLang)
            {
                string targetText = val.ToString();

                // if Language code has hyphen such as Chinene ... Hyphen not allow in Enums..
                if (targetText.Contains("_"))
                {
                    targetText = targetText.Replace('_', '-');
                }
                string url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl="
                             + sourcText + "&tl=" + targetText + "&dt=t&q=" + WWW.EscapeURL(sourceText);

                WWW www = new WWW(url);
                yield return(www);

                if (www.isDone)
                {
                    if (string.IsNullOrEmpty(www.error))
                    {
                        var N = JSONNode.Parse(www.text);// Json Parser
                        translatedText = N[0][0][0];
                        print(targetText + " : " + translatedText);
                        OnTranslatedWord(val, translatedText, sourceText);
                    }
                    else
                    {
                        //isError = true;
                        InternetNotWorking();
                        yield break;
                    }
                }
            }
            if (!isError)
            {
                _controller.ValueChange(db.GetDB().Count, db.GetList().Count);
                db.OnTranslated();
            }
        }
Esempio n. 29
0
            public static LocalisationGlobalVariable[] GetGlobalVariables(string key, SystemLanguage language)
            {
                if (_localisationMaps.TryGetValue(LanguageCodes.GetLanguageCode(language), out LocalisationMap map))
                {
                    string text = map.Get(key, true);

                    List <LocalisationGlobalVariable> keys = new List <LocalisationGlobalVariable>();

                    int index = 0;

                    while (index < text.Length)
                    {
                        int variableStartIndex = text.IndexOf(kVariableStartChars, index);

                        if (variableStartIndex != -1)
                        {
                            int variableEndIndex = text.IndexOf(kVariableEndChars, variableStartIndex);
                            if (variableEndIndex == -1)
                            {
                                throw new Exception("Can't find matching end bracket for variable in localised string");
                            }

                            int    variableKeyStartIndex = variableStartIndex + kVariableEndChars.Length + 1;
                            string variableKey           = text.Substring(variableKeyStartIndex, variableEndIndex - variableKeyStartIndex);

                            _globalVariables.TryGetValue(variableKey, out GlobalVariable info);
                            keys.Add(new LocalisationGlobalVariable(variableKey, info._version));

                            index = variableEndIndex + kVariableEndChars.Length;
                        }
                        else
                        {
                            break;
                        }
                    }

                    return(keys.ToArray());
                }

                return(null);
            }
Esempio n. 30
0
        public static IEnumerable <string> GetAudioLanguages(this IPlayableContent playableContent, string defaultAudioLanguage)
        {
            var languageCode  = playableContent.GetPreferredAudioLanguage(defaultAudioLanguage);
            var languageCodes = new List <string> {
                languageCode
            };
            var languageCodeShort = LanguageCodes.GetTwoLetterCode(languageCode);

            if (!string.IsNullOrWhiteSpace(languageCodeShort))
            {
                languageCodes.Add(languageCodeShort);
            }

            if (languageCode != LanguageCodes.English)
            {
                languageCodes.Add(LanguageCodes.English);
                languageCodes.Add(LanguageCodes.GetTwoLetterCode(LanguageCodes.English));
            }

            return(languageCodes);
        }
Esempio n. 31
0
        private void GetTargetLanguage(long selectedEnum, string word)
        {
            long value = (long)selectedEnum;
            List <LanguageCodes> list = new List <LanguageCodes>();
            int count = 0;
            int max   = System.Enum.GetNames(typeof(LanguageCodes)).Length;

            while (count < max)
            {
                long isOne = (value & 1);
                value = value >> 1;
                if (isOne == 1)
                {
                    list.Add((LanguageCodes)count);
                }
                count++;
            }
            LanguageCodes sourcecode = (LanguageCodes)sourceLanguage;
            Translate     translate  = GameObject.FindObjectOfType <Translate>();

            translate.Translation(sourcecode, list, word);
        }
Esempio n. 32
0
        public static MessageContainer Create(LanguageCodes code)
        {
            switch (code)
            {
            case LanguageCodes.en_GB:
                return(new MessageContainer()
                {
                    IsNotNullMessage = "'{0}' cannot be null.",
                    IsNotNullOrEmptyMessage = "'{0}' cannot be null or empty.",
                    IsNotNullOrWhiteSpaceMessage = "'{0}' cannot be null or whitespace only.",
                    IsNotZeroMessage = "'{0}' cannot be zero.",
                    IsPasswordMessage = "'{0}' is not a valid password. Passwords must be 8 to 30 characters, at least on 1 uppercase letter, at least 1 lowercase letter and at least one number.",
                    IsMinLengthMessage = "'{0}' must be a at least {1} characters.",
                    IsMaxLengthMessage = "'{0}' must be {1} characters or less.",
                    IsExactLengthMessage = "'{0}' must be exactly {1} characters.",
                    IsBetweenLengthMessage = "'{0}' must be at least {1} and at most {2} characters.",
                    IsMessage = "'{0}' does not match the specified criteria.",
                    IsNotMessage = "'{0}' does not match the specified criteria.",
                    IsEmailMessage = "'{0}' is not a valid email address.",
                    IsRegexMessage = "'{0}' does not match the provided regular expression.",
                    IsMatchMessage = "'{0}' did not match the specified criteria.",
                    IsDateMessage = "'{0}' is not a valid date.",
                    IsRuleMessage = "'{0}' failed the provided business rule provided.",

                    // Dates
                    IsGreaterThanMessage = "'{0}' must be greater than '{1}'.",
                    IsGreaterThanOrEqualToMessage = "'{0}' must be greater than or equal to '{1}'.",
                    IsLessThanMessage = "'{0}' must be less than '{1}'.",
                    IsLessThanOrEqualToMessage = "'{0}' must be less than or equal to '{1}'.",
                    IsEqualToMessage = "'{0}' must be equal to '{1}'.",
                    IsBetweenInclusiveMessage = "'{0}' must be between '{1}' and '{2}' (inclusive).",
                    IsBetweenExclusiveMessage = "'{0}' must be between '{1}' and '{2}' (exclusive)."
                });

            default:
                return(Create(LanguageCodes.en_GB));
            }
        }
Esempio n. 33
0
 public WaterFrontDistrict(Byte id, LanguageCodes langCode = LanguageCodes.EN, Boolean hardCore = false)
     : base(hardCore ? DistrictTypes.WATERFRONT_HARDCORE : DistrictTypes.WATERFRONT, id, langCode)
 { }
Esempio n. 34
0
 public FinancialDistrict(Byte id, LanguageCodes langCode = LanguageCodes.EN, Boolean hardCore = false)
     : base(hardCore ? DistrictTypes.FINANCIAL_HARDCORE : DistrictTypes.FINANCIAL, id, langCode)
 { }
Esempio n. 35
0
 public bool UpdateLanguageForCompID(int compId, LanguageCodes code)
 {
     var LanguageDAL = new LanguageDAL(testing);
     return LanguageDAL.UpdateLanguageForCompID(compId, code);
 }
Esempio n. 36
0
 /// <summary>
 /// Returns a list of strings for a specified language code.
 /// </summary>
 /// <param name="LangCode">The language code to retrieve strings for.</param>
 /// <returns>A list of strings for the specified language code.</returns>
 public List<TranslatedString> GetStringList(LanguageCodes LangCode)
 {
     return Strings[LangCode];
 }
Esempio n. 37
0
 public string GetString(LanguageCodes LangCode, int Index)
 {
     return Strings[LangCode][Index].TranslatedStr;
 }
Esempio n. 38
0
 /// <summary>
 /// Updates a CompID's language code. Does not set language for a CompID
 /// only updates.
 /// </summary>
 /// <param name="compId"></param>
 /// <param name="code"></param>
 /// <returns>true or false depending on success</returns>
 public bool UpdateLanguageForCompID(int compId, LanguageCodes code)
 {
     var toUpdate = GetExactRowByCompID(compId);
     try
     {
         using (var db = new BlissBaseContext(testing))
         {
             toUpdate.LangCode = code;
             db.SaveChanges();
             return true;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("A Exception was thrown when trying to update language code for " +
             "CompId: " + compId + ". Might be that composite sybol is defined as international");
         Debug.WriteLine(e.StackTrace);
         return false;
     }
 }
Esempio n. 39
0
        /// <summary>
        /// Sets a non international language for a CompID
        /// </summary>
        /// <param name="compId"></param>
        /// <param name="code"></param>
        /// <returns>true or false depending on success</returns>
        public bool SetLanguageForCompID(int compId, LanguageCodes code)
        {
            var toAdd = new Languages
            {
                CompID = compId,
                LangCode = code
            };

            try
            {
                using (var db = new BlissBaseContext(testing))
                {
                    db.Languages.Add(toAdd);
                    db.SaveChanges();
                    return true;
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("An exception was thrown when defining composite symbol: " + compId +
                    " as non international, with LanguageCodes: " + code);
                Debug.WriteLine(e.StackTrace);
                return false;
            }
        }
Esempio n. 40
0
 public static string Type2Text(LanguageCodes value)
 {
     switch (value)
     {
         case LanguageCodes.VI: return Languages.Libs.GetString("vietnamese");
         default: return Languages.Libs.GetString("english");
     }
 }