//(*) LocalizeString overload
 public void Send(LocalizeString text, string contentURI)
 {
     if (text != null)
     {
         Send(text.Text, contentURI);
     }
 }
Exemple #2
0
 //(*) LocalizeString overload
 public void Show(LocalizeString message)
 {
     if (message != null)
     {
         Show(message.Text);
     }
 }
 //(*) LocalizeString overload
 public void Show(LocalizeString text)
 {
     if (text != null)
     {
         Show(text.Text);
     }
 }
 //(*) LocalizeString overload
 public void Send(LocalizeString text)
 {
     if (text != null)
     {
         Send(text.Text);
     }
 }
 //(*) LocalizeString overload
 public void Show(LocalizeString message, bool longDuration)
 {
     if (message != null)
     {
         Show(message.Text, longDuration);
     }
 }
Exemple #6
0
        //Deep copy
        public LocalizeString Clone()
        {
            LocalizeString loc = (LocalizeString)MemberwiseClone();

            loc.initialized = false;
            loc.list        = new List <Data>(this.list.Count);
            foreach (var item in this.list)
            {
                loc.list.Add(item.Clone());
            }
            return(loc);
        }
 //(*) LocalizeString overload
 //Add attachment
 //Set values dynamically and show Mailer (current values will be overwritten)
 public void Show(string mailAddress, LocalizeString subject, LocalizeString body, string attachmentURI)
 {
     this.mailAddress = mailAddress;
     if (subject != null)
     {
         this.subject = subject.Text;
     }
     if (body != null)
     {
         this.body = body.Text;
     }
     SetAttachment(attachmentURI);
     Show();
 }
        //Specify the language and returns the localized character string linked with the ID (it will be 'def' if ID or language is not found)
        //言語を指定して、ID に紐付けされたローカライズ文字列を返す(IDや言語が見つからないときは def になる)
        public string Text(string id, SystemLanguage language, string def = "", bool notFoundIsDefaultLanguage = true)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(def);
            }

            LocalizeString loc = this[id];

            if (loc != null)
            {
                return(loc.TextByLanguage(language, def, notFoundIsDefaultLanguage));  //If not found, it becomes 'def'.
            }
            return(def);
        }
        //Returns the localized character string linked with the ID (it will be 'def' if ID or language is not found)
        //ID に紐付けされた、ローカライズ文字列を返す(IDや言語が見つからないときは def になる)
        public string Text(string id, string def = "")
        {
            if (string.IsNullOrEmpty(id))
            {
                return(def);
            }

            LocalizeString loc = this[id];

            if (loc != null)
            {
                return(loc.TextOrDefault(def));
            }
            return(def);
        }
        //Specify the language and returns the localized string's font size linked with the ID (it will be 'def' if ID or language is not found)
        //言語を指定して、ID に紐付けされたローカライズ文字列のフォントサイズを返す(IDや言語が見つからないときは def になる)
        public int FontSize(string id, SystemLanguage language, int def = 0, bool notFoundIsDefaultLanguage = true)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(def);
            }

            LocalizeString loc = this[id];

            if (loc != null)
            {
                return(loc.FontSizeByLanguage(language, def, notFoundIsDefaultLanguage));
            }
            return(def);
        }
        //Returns the localized string's font size linked with the ID (it will be 'def' if ID or language is not found)
        //ID に紐付けされた、ローカライズ文字列のフォントサイズを返す(IDや言語が見つからないときは def になる)
        public int FontSize(string id, int def = 0)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(def);
            }

            LocalizeString loc = this[id];

            if (loc != null)
            {
                return(loc.FontSizeOrDefault(def));
            }
            return(def);
        }
        //Get text from LocalizeString and replace.
        //LocalizeStringからテキストを取得し、置き換える。
        private void ApplyLocalizeToText(Text targetText, SystemLanguage language = SystemLanguage.Unknown)
        {
            if (targetText == null)
            {
                return;
            }

            string str      = "";
            int    fontSize = 0;

            switch (resourceType)
            {
            case ResourceType.Local:
                if (localize != null)
                {
                    str      = localize.TextByLanguage(language);
                    fontSize = localize.FontSizeByLanguage(language);
                }
                break;

            case ResourceType.Resource:
                if (localizeData.localizeResource != null)
                {
                    LocalizeString loc = localizeData.localizeResource[localizeData.textID];
                    if (loc != null)        //ID is found
                    {
                        str      = loc.TextByLanguage(language);
                        fontSize = loc.FontSizeByLanguage(language);
                    }
                }
                break;
            }

            if (!string.IsNullOrEmpty(str))
            {
                targetText.text = str;
                if (fontSize > 0)
                {
                    targetText.fontSize = fontSize;
                }
            }
        }