private static void loadTranslations()
        {
            // If file/directory doesn't exist
            if (!checkFiles())
            {
                // Stop loading translations
                return;
            }

            // Create stream to go over file's data
            using (FileStream fileStream = File.Open(CurrentTranslationsPath, FileMode.Open, FileAccess.Read))
            {
                LastUpdated = File.GetLastWriteTime(CurrentTranslationsPath);

                // Binary reader for parsing of data
                using (BinaryReader reader = new BinaryReader(fileStream))
                {
                    // Clear translations
                    Translations.Clear();

                    // Get number of translations
                    int count = reader.ReadInt32();

                    for (int i = 0; i < count; i++)
                    {
                        // Get translation header and format
                        string header = reader.ReadString();
                        string format = reader.ReadString();

                        Translations.Add(header, format);
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void UpdateInstalledTranslations()
 {
     try
     {
         Regex         r = new Regex(@"\<TranslationVersion\>(\d+)\<\/TranslationVersion\>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
         List <string> lTranslationsInstalled = UrlUtil.GetFilePaths(PluginUpdateHandler.PluginsTranslationsFolder, Name + "*.language.xml", SearchOption.TopDirectoryOnly);
         foreach (string lang in lTranslationsInstalled)
         {
             string translation = File.Exists(lang) ? File.ReadAllText(lang) : string.Empty;
             Match  m           = r.Match(translation);
             if (m.Groups.Count != 2)
             {
                 continue;
             }
             long lVerInstalled = 0;
             if (!long.TryParse(m.Groups[1].Value, out lVerInstalled))
             {
                 continue;
             }
             string sLang = UrlUtil.GetFileName(lang);
             TranslationVersionCheck tvc = Translations.Find(x => x.LangugageFile == sLang);
             if (tvc == null)
             {
                 tvc = new TranslationVersionCheck()
                 {
                     LangugageFile = sLang
                 };
                 Translations.Add(tvc);
             }
             tvc.Installed = lVerInstalled;
         }
     }
     catch (Exception) { }
 }
Exemplo n.º 3
0
        private void AddNewTranslation(object sender, RoutedEventArgs e)
        {
            var combo = (AvailableLanguages.SelectedItem as ComboBoxItem);

            if (combo != null)
            {
                var langID = (int)combo.Tag;
                var vm     = new TranslationViewModel()
                {
                    Translation    = "Translation",
                    Pronounciation = "Pronounce",
                    Significance   = 1.0,
                };

                if (Translations.ContainsKey(langID))
                {
                    Translations[langID].Add(vm);
                }
                else
                {
                    Translations.Add(langID, new List <TranslationViewModel>()
                    {
                        vm
                    });
                }

                FilteredTranslations.Add(vm);
            }
        }
Exemplo n.º 4
0
 public void AddTranslations(Dictionary <string, string> values)
 {
     foreach (var item in values)
     {
         Translations.Add(item.Key, item.Value);
     }
 }
Exemplo n.º 5
0
 void view_RaiseCustomEvent(object sender, CustomEventArgs e)
 {
     foreach (Translation translation in e.Translations)
     {
         Translations.Add(translation);
     }
 }
 /// <summary>
 /// Creates a new object.
 /// </summary>
 public HandshakeEnumConverter() : base()
 {
     Translations.Add(Handshake.None, Strings.SerialHandshakeNone);
     Translations.Add(Handshake.RequestToSend, Strings.SerialHandshakeRts);
     Translations.Add(Handshake.RequestToSendXOnXOff, Strings.SerialHandshakeRtsXOnXOff);
     Translations.Add(Handshake.XOnXOff, Strings.SerialHandshakeXOnXOff);
 }
 /// <summary>
 /// Creates a new object.
 /// </summary>
 public StopBitsEnumConverter() : base()
 {
     Translations.Add(StopBits.None, Strings.SerialStopBitsNone);
     Translations.Add(StopBits.One, Strings.SerialStopBitsOne);
     Translations.Add(StopBits.OnePointFive, Strings.SerialStopBitsOnePointFive);
     Translations.Add(StopBits.Two, Strings.SerialStopBitsTwo);
 }
 public static void ImportTranslations(string filename)
 {
     try
     {
         var data    = File.ReadAllLines(filename);
         var locales = data[0].Split(',');
         foreach (var str in data.Skip(1))
         {
             var line = str.Split(',');
             try
             {
                 Translations.Add(line[0], new Dictionary <string, string>());
                 for (int i = 0; i < line.Length; i++)
                 {
                     Translations[line[0]][locales[i]] = line[i];
                 }
             }
             // ReSharper disable once EmptyGeneralCatchClause
             catch
             {
             }
         }
     }
     catch (Exception e)
     {
         Debug.LogError($"Error when reading translation file: {e.Message}");
     }
 }
Exemplo n.º 9
0
        }                                           // validTo


        public void GetMetadataByUuid()
        {
            SimpleMetadata metadata = MetadataService.FetchMetadata(UuidExternal);

            Type = "Ikke satt";
            if (metadata != null)
            {
                name = metadata.Title;
                if (Translations.Count == 0)
                {
                    Translations.Add(new AlertTranslation());
                }
                Translations[0].Name = metadata.EnglishTitle;
                if (metadata.DistributionDetails != null && metadata.DistributionDetails?.Protocol != null)
                {
                    Type = metadata.DistributionDetails.Protocol;
                }

                if (metadata.ContactOwner != null)
                {
                    Owner = metadata.ContactOwner.Organization;
                    Translations[0].Owner = metadata.ContactOwner.OrganizationEnglish;
                }
                UrlExternal = WebConfigurationManager.AppSettings["KartkatalogenUrl"] + "metadata/uuid/" + UuidExternal;
            }
        }
 /// <summary>
 /// Creates a new object.
 /// </summary>
 public ParityEnumConverter() : base()
 {
     Translations.Add(Parity.Even, Strings.SerialParityEven);
     Translations.Add(Parity.Mark, Strings.SerialParityMark);
     Translations.Add(Parity.None, Strings.SerialParityNone);
     Translations.Add(Parity.Odd, Strings.SerialParityOdd);
     Translations.Add(Parity.Space, Strings.SerialParitySpace);
 }
Exemplo n.º 11
0
 private void PopulateTranslations()
 {
     Translations.Clear();
     foreach (var te in Entity.Translations.Where(t => !t.Deleted).OrderBy(t => t.Language))
     {
         Translations.Add(ServiceProvider.Inject(new TranslationVM(this, te)));
     }
 }
Exemplo n.º 12
0
 public void AddName(OAuthTranslation translation)
 {
     translation.Type = "name";
     Translations.Add(new UMAResourceTranslation
     {
         Translation = translation
     });
 }
Exemplo n.º 13
0
 public void AddDescription(OAuthTranslation translation)
 {
     translation.Type = "description";
     Translations.Add(new UMAResourceTranslation
     {
         Translation = translation
     });
 }
        /// <summary> Add a new translation for the display term </summary>
        /// <param name="Language"> Language in which this value is represented </param>
        /// <param name="Value"> Value in provided language </param>
        public void Add_Translation(Web_Language_Enum Language, string Value)
        {
            if (Translations == null)
            {
                Translations = new List <Web_Language_Translation_Value>();
            }

            Translations.Add(new Web_Language_Translation_Value(Language, Value));
        }
Exemplo n.º 15
0
 private void AddTranslationsFromWord()
 {
     foreach (var translation in m_selectedWord.Translations)
     {
         Translations.Add(new TranslationItem {
             Translation = translation.Value
         });
     }
 }
Exemplo n.º 16
0
        /// <summary>
        ///     将字符串解析成Fade
        /// </summary>
        /// <param name="data"></param>
        public void Parse(string data)
        {
            while (data.StartsWith(" "))
            {
                data = data.Remove(0, 1);
            }
            var parts = data.Split(',');

            if (parts[0] != "F")
            {
                throw new ArgumentException("该行的数据不适用。");
            }
            var ed = parts[3];

            if (string.IsNullOrEmpty(ed))
            {
                parts[3] = parts[2];
            }
            var suc = int.TryParse(parts[1], out var eas);

            if (suc)
            {
                Easing = (StoryBoardEasing)eas;
            }
            else
            {
                Easing = StoryBoardTools.GetStoryBoardEasingByString(parts[1]);
            }
            StartTime = int.Parse(parts[2]);
            EndTime   = int.Parse(parts[3]);
            var i = 4;
            var j = 1;

            if (i + 1 == parts.Length)
            {
                Translations.Add(
                    new FadeTranslation(double.Parse(parts[4]), double.Parse(parts[4]), StartTime, EndTime));
            }
            while (true)
            {
                var stindex = i;
                var st      = double.Parse(parts[i++]);
                var end     = double.Parse(parts[i]); /*(parts[i + 1 < parts.Length ? i++ : i + 1 == parts.Length ? i : stindex])*/;
                var dur     = EndTime - StartTime;
                Translations.Add(new FadeTranslation(st, end, StartTime + dur * j, EndTime + dur * j));
                if (i + 1 < parts.Length)
                {
                    i--;
                }
                j++;
                if (i + 1 >= parts.Length)
                {
                    break;
                }
            }
        }
Exemplo n.º 17
0
 public void AddLogoUri(string language, string value)
 {
     Translations.Add(new OAuthClientTranslation
     {
         Translation = new OAuthTranslation($"{ClientId}_logo_uri", value, language)
         {
             Type = "logo_uri"
         }
     });
 }
Exemplo n.º 18
0
 public void AddPolicyUri(string language, string value)
 {
     Translations.Add(new OAuthClientTranslation
     {
         Translation = new OAuthTranslation($"{ClientId}_policy_uri", value, language)
         {
             Type = "policy_uri"
         }
     });
 }
Exemplo n.º 19
0
 public void AddClientName(string language, string value)
 {
     Translations.Add(new OAuthClientTranslation
     {
         Translation = new OAuthTranslation($"{ClientId}_client_name", value, language)
         {
             Type = "client_name"
         }
     });
 }
Exemplo n.º 20
0
        public void buildTranslations()
        {
            List <string> cultures = CultureHelper.getCultures();

            for (int i = 0; i < cultures.Count; i++)
            {
                ProductTranslation producttranslation = new ProductTranslation();
                producttranslation.Lang = cultures[i];
                Translations.Add(producttranslation);
            }
        }
Exemplo n.º 21
0
 public string Translate(string key, string text)
 {
     if (Translations.ContainsKey(key))
     {
         return(Translations[key]);
     }
     else
     {
         Translations.Add(key, text);
         return(text);
     }
 }
Exemplo n.º 22
0
        private static void UpgradeTranslations(Translations translations)
        {
            var defaults = Translations.CreateDefault();

            foreach (var item in defaults)
            {
                if (!translations.ContainsKey(item.Key))
                {
                    translations.Add(item.Key, item.Value);
                }
            }
        }
Exemplo n.º 23
0
        public void ParseCardXmlNodes(XmlNode xmlNode)
        {
            //create a new translation
            var translation = new Translation();

            //read it in
            XmlFileBuddy.ReadChildNodes(xmlNode, translation.ParseChildNode);

            //If there was no translation in the card, don't store it
            if (!string.IsNullOrEmpty(translation.Language) && !string.IsNullOrEmpty(translation.Word))
            {
                //store the card
                Translations.Add(translation);
            }
        }
Exemplo n.º 24
0
        void AddTranslation()
        {
            var translation = new Translation
            {
                Title = Entry.Title
            };

            _realm.Write(() => {
                Entry.Translations.Add(translation);
            });
            Translations.Add(new TranslationViewModel(translation));
            OnPropertyChanged(nameof(Translations));

            CurrentTranslationIndex = Translations.Count - 1;
        }
Exemplo n.º 25
0
        /// <summary>
        ///     将字符串解析成Fade
        /// </summary>
        /// <param name="data"></param>
        public void Parse(string data)
        {
            var parts = data.Split(',');
            var suc   = int.TryParse(parts[1], out var eas);

            if (suc)
            {
                Easing = (StoryBoardEasing)eas;
            }
            else
            {
                Easing = StoryBoardTools.GetStoryBoardEasingByString(parts[1]);
            }
            StartTime = int.Parse(parts[2]);
            var ed = parts[3];

            if (string.IsNullOrEmpty(ed))
            {
                parts[3] = parts[2];
            }
            EndTime = int.Parse(parts[3]);
            var i = 4;
            var j = 1;

            if (i + 3 == parts.Length)
            {
                Translations.Add(new ColorTranslation(
                                     new RgbColor(int.Parse(parts[4]), int.Parse(parts[5]), int.Parse(parts[6])),
                                     new RgbColor(int.Parse(parts[4]), int.Parse(parts[5]), int.Parse(parts[6])), StartTime, EndTime));
            }
            while (i + 3 < parts.Length)
            {
                var r   = int.Parse(parts[i + 1 < parts.Length ? i++ : i]);
                var g   = int.Parse(parts[i + 1 < parts.Length ? i++ : i]);
                var b   = int.Parse(parts[i + 1 < parts.Length ? i++ : i]);
                var er  = int.Parse(parts[i + 1 < parts.Length ? i++ : i == parts.Length ? r : i]);
                var eg  = int.Parse(parts[i + 1 < parts.Length ? i++ : i == parts.Length ? r : i]);
                var eb  = int.Parse(parts[i + 1 < parts.Length ? i++ : i == parts.Length ? r : i]);
                var dur = EndTime - StartTime;
                Translations.Add(new ColorTranslation(new RgbColor(r, b, g), new RgbColor(er, eb, eg),
                                                      StartTime + j * dur, EndTime + j * dur));
                j++;
                if (i + 1 < parts.Length)
                {
                    i -= 3;
                }
            }
        }
Exemplo n.º 26
0
        /// <summary>
        ///     使用字符串构建一个Move对象
        /// </summary>
        /// <param name="data"></param>
        public void Parse(string data)
        {
            var datas = data.Split(',');

            if (int.TryParse(datas[1], out var eas))
            {
                Easing = (StoryBoardEasing)eas;
            }
            else
            {
                Easing = StoryBoardTools.GetStoryBoardEasingByString(datas[1]);
            }
            StartTime = int.Parse(datas[2]);
            var ed = datas[3];

            if (string.IsNullOrEmpty(ed))
            {
                datas[3] = datas[2];
            }
            EndTime = int.Parse(datas[3]);
            int i = 4, j = 0;

            if (i + 2 == datas.Length)
            {
                Translations.Add(new MoveTranslation(
                                     new StoryBoardPoint(double.Parse(datas[4]), double.Parse(datas[5])),
                                     new StoryBoardPoint(double.Parse(datas[4]), double.Parse(datas[5])),
                                     StartTime, EndTime));
            }
            while (i + 2 < datas.Length)
            {
                var stindex = i;
                var stx     = double.Parse(datas[i++]);
                var sty     = double.Parse(datas[i++]);
                var edx     = double.Parse(datas[i + 1 < datas.Length ? i++ : i + 1 == datas.Length ? i : stindex]);
                var edy     = double.Parse(datas[i + 1 < datas.Length ? i++ : i + 1 == datas.Length ? i : stindex + 1]);
                var dur     = EndTime - StartTime;
                Translations.Add(new MoveTranslation(new StoryBoardPoint(stx, sty),
                                                     new StoryBoardPoint(edx, edy),
                                                     StartTime + j * dur, EndTime + j * dur));
                j++;
                if (i + 1 < datas.Length)
                {
                    i -= 2;
                }
            }
        }
Exemplo n.º 27
0
        private static void loadTranslations(BinaryReader reader)
        {
            Translations.Clear();

            // Get number of translations
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                // Get translation header/format
                string header = reader.ReadString();
                string format = reader.ReadString();

                // Add to global list
                Translations.Add(header, format);
            }
        }
Exemplo n.º 28
0
        public Bibeln()
        {
            Translations.Add(new BibelCom {
                Short = "B-DELUT", Trans = "51", Text = "B: Luther 1912"
            });
            Translations.Add(new BibelCom {
                Short = "B-HFA", Trans = "73", Text = "B: Hoffnung für alle"
            });
            Translations.Add(new BibelCom {
                Short = "B-ELB", Trans = "57", Text = "B: Elberfelder 1905"
            });
            Translations.Add(new BibelCom {
                Short = "B-SCH2000", Trans = "157", Text = "B: Schlachter 2000"
            });
            Translations.Add(new BibelCom {
                Short = "B-NGU2011", Trans = "108", Text = "B: Neue Genfer Übersetzung"
            });

            Translations.Add(new BibelServer {
                Short = "LUT", Text = "BS: Lutherbibel 2017"
            });
            Translations.Add(new BibelServer {
                Short = "ELB", Text = "BS: Elberfelder Bibel"
            });
            Translations.Add(new BibelServer {
                Short = "HFA", Text = "BS: Hoffnung für Alle"
            });
            Translations.Add(new BibelServer {
                Short = "SLT", Text = "BS: Schlachter 2000"
            });
            Translations.Add(new BibelServer {
                Short = "ZB", Text = "BS: Zürcher Übersetzung"
            });
            Translations.Add(new BibelServer {
                Short = "KJV", Text = "BS: King James Version"
            });
            Translations.Add(new BibelServer {
                Short = "NIV", Text = "BS: New International Version"
            });
            Translations.Add(new BibelServer {
                Short = "ESV", Text = "BS: English Standard Version"
            });
            Translations.Add(new BibelServer {
                Short = "ESV", Text = "BS: English Standard Version"
            });
        }
Exemplo n.º 29
0
        /// <inheritdoc />

        public void Parse(string line)
        {
            var datas = line.Split(',');

            if (int.TryParse(datas[1], out var eas))
            {
                Easing = (StoryBoardEasing)eas;
            }
            else
            {
                Easing = StoryBoardTools.GetStoryBoardEasingByString(datas[1]);
            }
            if (string.IsNullOrEmpty(datas[3]))
            {
                datas[3] = datas[2];
            }
            StartTime = int.Parse(datas[2]);
            EndTime   = int.Parse(datas[3]);
            int i = 4, j = 0;

            if (i + 2 == datas.Length)
            {
                Translations.Add(new VectorScaleTranslation(
                                     new VectorScaleMultiplier(double.Parse(datas[4]), double.Parse(datas[5])),
                                     new VectorScaleMultiplier(double.Parse(datas[4]), double.Parse(datas[5])),
                                     StartTime, EndTime));
            }
            while (i + 2 < datas.Length)
            {
                var stindex   = i;
                var initindex = i;
                var xst       = double.Parse(datas[i++]);
                var xed       = double.Parse(datas[i + 1 < datas.Length ? i++ : i + 1 == datas.Length ? i : stindex]);
                var yst       = double.Parse(datas[i + 1 < datas.Length ? i++ : i + 1 == datas.Length ? i : initindex]);
                var yed       = double.Parse(datas[i + 1 < datas.Length ? i++ : i + 1 == datas.Length ? i : initindex]);
                var dur       = EndTime - StartTime;
                Translations.Add(new VectorScaleTranslation(new VectorScaleMultiplier(xst, xed),
                                                            new VectorScaleMultiplier(yst, yed), StartTime + j * dur, EndTime + j * dur));
                j++;
                if (i + 1 < datas.Length)
                {
                    i -= 2;
                }
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Sets the translation for the specified language.
        /// </summary>
        /// <param name="parentId">The parent id</param>
        /// <param name="languageId">The language id</param>
        /// <param name="model">The model</param>
        public void SetTranslation(Guid parentId, Guid languageId, object model)
        {
            if (model is Models.GenericContent content)
            {
                var translation = Translations.FirstOrDefault(t => t.LanguageId == languageId);

                if (translation == null)
                {
                    translation = new ContentTranslation
                    {
                        ContentId  = content.Id,
                        LanguageId = languageId
                    };
                    Translations.Add(translation);
                }
                translation.Title = content.Title;
            }
        }