private void OnGUI()
    {
        int    secondToDisplay = Mathf.FloorToInt(Time.timeSinceLevelLoad) % 4 + 1;
        string secondToken     = TranslationUtility.get(secondToDisplay.ToString());
        string textToDisplay   = TranslationUtility.getFormatted(textFormat, secondToken);

        GUILayout.Label(textToDisplay);
        textMesh.text = textToDisplay;

        //get the username from the
        GUILayout.BeginHorizontal();
        GUILayout.Label("Username:"******"Translate to language: {0}", languageCode)))
            {
                TranslationUtility.changeStaticInstanceConfig(languageCode);
            }
        }
    }
    public void OnGUI()
    {
        GUILayout.Label("options");

        //This is just to show that you can switch langauges too!
        languageSelectToggle = GUILayout.Toggle(languageSelectToggle, "Language Select");
        if (languageSelectToggle)
        {
            if (GUILayout.Button("English"))
            {
                TranslationUtility.changeStaticInstanceConfig("en-us");
            }
            if (GUILayout.Button("French"))
            {
                TranslationUtility.changeStaticInstanceConfig("fr-fr");
            }
            if (GUILayout.Button("German"))
            {
                TranslationUtility.changeStaticInstanceConfig("de-de");
            }
            if (GUILayout.Button("Backwards (test language)"))
            {
                TranslationUtility.changeStaticInstanceConfig("xx-xx");
            }
        }
    }
Example #3
0
    private void OnGUI()
    {
        GUILayout.Label("Test manual text:" + testText);

        GUILayout.BeginVertical();
        scrollPosition = GUILayout.BeginScrollView(scrollPosition);
        int guiHeight = 40;
        int currenty  = 0;

        foreach (TransfluentLanguage language in supportedLanguages)
        {
            if (GUILayout.Button(language.name))
            {
                TranslationUtility.changeStaticInstanceConfig(language.code);
                translationHelper = TranslationUtility.getUtilityInstanceForDebugging();

                foreach (var trans in translationHelper.allKnownTranslations)
                {
                    Debug.Log(string.Format("key:{0} value:{1}", trans.Key, trans.Value));
                }
            }
            currenty += guiHeight;
        }
        GUILayout.EndScrollView();

        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        if (translationHelper != null)
        {
            foreach (var translation in translationHelper.allKnownTranslations)
            {
                GUILayout.Label(string.Format("text id:{0} group id:{1} text:{2}", translation.Key,
                                              ((TranslationUtilityInstance)translationHelper).groupBeingShown, translation.Value));
            }
        }
        GUILayout.EndVertical();
    }