Search Unity

Bug Time formatter broken for French, possibly other languages as well.

Discussion in 'Localization Tools' started by tuntorius, Feb 10, 2023.

  1. tuntorius

    tuntorius

    Joined:
    Jul 31, 2013
    Posts:
    3
    I want to display time passed with only the most significant unit, for example:
    2m ago, 1h ago, 5d ago, etc...
    For this, I'm using the following format:
    {0:time(abbr|short)} ago
    and I'm supplying a TimeSpan variable in GetLocalizedString()
    In English, it works fine. In French, however, I get this error:

    OperationException : Error parsing format string: No suitable Formatter could be found at 19

    I then copied the English string to the French table, believing I had the French one wrong. No difference. I even tried without any text at all, just using the part with curly brackets. I still get the same error.
    I believe that the method in the plugin that expands the TimeSpan to string is hardcoded to work in English only, or with languages with the same date formatting
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Yes, unfortunately, the current implementation of the TimeSpanUtility does seem to only support English.
    We are aware of the issue, I'll also create a bug so we can escalate it. https://issuetracker.unity3d.com/product/unity/issues/guid/LOC-886
    There is support for defining your own rules however you would need to move the package into the project so you can make changes. We will look to improve this in the future.

    If you want to define your own rules I can walk you through it.
     
    Last edited: Feb 10, 2023