Esempio n. 1
0
 public async Task <ActionResult> SaveLanguage(CountryLanguage countryLanguage)
 {
     try
     {
         string redirectURL = string.Empty;
         LocalizationManager objLocalization = new LocalizationManager();
         if (countryLanguage.LanguageName.Length > 0)
         {
             string[] langs       = countryLanguage.LanguageName.Split("##");
             string[] countrylang = langs[0].Split(' ');
             countryLanguage.CultureName = langs[0];
             countryLanguage.CultureCode = langs[1];
             countryLanguage.Country     = countrylang[1];
             countryLanguage.Country     = countryLanguage.Country.Substring(1, countryLanguage.Country.Length - 2);
             countryLanguage.Language    = countrylang[0];
             string[] langcode = langs[1].Split('-');
             countryLanguage.CountryCode  = langcode[1];
             countryLanguage.LanguageCode = langcode[0];
             await objLocalization.Add(countryLanguage, GetUsername);
         }
         redirectURL = nameof(Index);
         return(RedirectToAction(redirectURL));
     }
     catch (Exception ex)
     {
         ProcessException(ex);
         return(View("Index"));
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        label = GetComponent <TextMeshProUGUI>();

        LocalizationManager.Add(this);

        Refresh();
    }
Esempio n. 3
0
    public void OnGUI()
    {
        EditorGUI.BeginChangeCheck();
        Key = EditorGUILayout.TextField("Key: ", Key);
        if (EditorGUI.EndChangeCheck())
        {
            for (int i = 0; i < Values.Length; i++)
            {
                Values[i] = LocalizationManager.GetLocalizedValue(Key, (LocalizationManager.LocalizedLanguage)System.Enum.GetValues(typeof(LocalizationManager.LocalizedLanguage)).GetValue(i));
            }
        }

        EditorGUILayout.BeginVertical();

        for (int i = 0; i < Values.Length; i++)
        {
            EditorGUILayout.LabelField(System.Enum.GetName(typeof(LocalizationManager.LocalizedLanguage), i) + " Value: ", GUILayout.MaxWidth(100));

            EditorStyles.textArea.wordWrap = true;
            Values[i] = EditorGUILayout.TextArea(Values[i], EditorStyles.textArea, GUILayout.Height(100), GUILayout.Width(400));
        }

        EditorGUILayout.EndVertical();

        if (GUILayout.Button("Add / Edit"))
        {
            if (IsKeyDefined(Key))
            {
                LocalizationManager.Replace(Key, Values);
            }
            else
            {
                LocalizationManager.Add(Key, Values);
            }
            Selection.activeGameObject.GetComponent <Localize>().SetKey(Key);
        }

        minSize = new Vector2(460, 500);
        maxSize = minSize;
    }