Search Unity

Broken symbols

Discussion in 'Localization Tools' started by kenor_brooks, Dec 3, 2021.

  1. kenor_brooks

    kenor_brooks

    Joined:
    Jun 4, 2020
    Posts:
    46
    When I localize the game into Russian, I get these characters. In the tables all is normal. When I run the game in the editor or on the phone and switch the language some of the characters become a square.(ж, ч, ц, е) upload_2021-12-3_13-3-28.png
     

    Attached Files:

  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,276
    This indicates the character is missing from the font. You should make sure to use a font that supports the character set for the language. The default Text font(Arial) works different from other fonts and may not support the same character sets on each platform.

    Google has some good fonts https://fonts.google.com/
    You can use the localized property variants feature to set a font per language https://docs.unity3d.com/Packages/com.unity.localization@1.0/manual/LocalizedPropertyVariants.html
     
  3. kenor_brooks

    kenor_brooks

    Joined:
    Jun 4, 2020
    Posts:
    46
    Sorry, but I didn't find a link where you can globally change the font for different languages. Maybe I do not allow my knowledge of English, written there is quite complicated and not clear. Could you please indicate where I can change the font for the Russian language in the whole project?
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,276
    There's no support for doing something like that I'm afraid. You will need to go through and change each Text. You could write a script to automate it for you if it's a lot.
    For example, you could do:

    Code (csharp):
    1. public class FontSwitcher : MonoBehaviour
    2. {
    3.     [Serializable]
    4.     public LocalizedAsset<Font> localizedFont = new LocalizedAsset<Font> { TableReference = "My Asset Table", TableEntryReference = "My Global Font" };
    5.  
    6.     public Text uiText;
    7.  
    8.     void OnEnable()
    9.     {
    10.         localizedFont.AssetChanged += FontChanged;
    11.     }
    12.  
    13.     void OnDisable()
    14.     {
    15.         localizedFont.AssetChanged -= FontChanged;
    16.     }
    17.  
    18.     void FontChanged(Font f)
    19.     {
    20.         uiText.font = f;
    21.     }
    22.  
    23.     void UpdateText(string s)
    24.     {
    25.         uiText.text = s;
    26.     }
    27. }
    Then just add this script to your text objects.
    You could write a script to go through your scenes/prefabs and add this script.