[fixed] Transifex error with ' in text? (1 Viewer)

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I just found two missing ' ' (first and last char) inside Transifex resources:

    {0}' at host '{1}
    This is already the case for english version https://www.transifex.com/projects/p/MP2/resource/SkinBase/l/en/view/

    Our strings_en.xml for SkinBase contains still the right text:
    XML:
    <string name="ServerConnection.ServerFormatText">'{0}' at host '{1}'</string> <!-- {0} = server name, {1} = host name -->
    but german already misses them:
    XML:
    <string name="ServerConnection.ServerFormatText">{0}' auf Rechner '{1}</string>
    @chefkoch, do you know this issue? Is it a problem of our helper during upload or a problem of Transifex?
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    I've had noticed similar too - after switching to Transifex for OnlineVideos.
    So I checked the docs at transifex and found:
    Code:
    // Android String Resources Format Has Escaped apostrophes
    so I load the Translation files with a replace:
    Code:
    stringEntry.InnerText.Replace(@"\'", "'"));

    I thought we already do this in MP2?
     

    chefkoch

    Retired Team Member
  • Premium Supporter
  • October 5, 2004
    3,129
    1,634
    Dresden / Munich / Maastricht
    Home Country
    Germany Germany
    We are doing the replace for MP2 within the TransifexHelper after checking out the translations we fix encoding like apostrophes and line endings (to prevent all files being displayed as modified).
    https://github.com/MediaPortal/Medi...aPortal/Tools/TransifexHelper/Program.cs#L380

    Problem here seems to be Transifex expecting the apostrophes defining the start and end of the string and leaving it out.

    The official Android string resource documentation says:
    XML:
    <string name="good_example">"This'll work"</string>
    <string name="good_example_2">This\'ll also work</string>
    <string name="bad_example">This doesn't work</string>
    <string name="bad_example_2">XML encodings don&apos;t work</string>

    Imo the quotes in first example are totally redundant since it is an inner text of the element where start and end are defined by > and <.
    Nevertheless I suggest to use the escaping in all strings.

    @morpheus_xx
    Should we replace the ' by \' before sending to Transifex or simply move the code for the replacements into MP2 core itself and strictly use \' within the files?
    I would prefer the second option.
     

    chefkoch

    Retired Team Member
  • Premium Supporter
  • October 5, 2004
    3,129
    1,634
    Dresden / Munich / Maastricht
    Home Country
    Germany Germany
    I've added the string replacement right now: https://github.com/MediaPortal/MediaPortal-2/commit/dbb46f66c610aa017bd778da49839356f656e3b5

    Didn't test it yet, but should work. Do we now need to fix all language files that contain the apostrophes?
    Was also working on it :D but had issues committing it due to issue with internet provider....... :sick:

    Quotes might also be escaped if being used. Currently this is not the case, but to solve it properly we might need take care of it as well?
    Should the code be moved to a separate method where the text
    • is being trimmed
    • \' replaced by '
    • and \" replaced by "
    Or maybe wrap the code before .Replace() to a new line for better readability.

    I removed the replace from the TransifexHelper: https://github.com/MediaPortal/MediaPortal-2/commit/e02ce7d967ae3de39b47287ac4310990f23dbcb9

    I will take care of updating the cache and the existing translations.
     
    Last edited:

    chefkoch

    Retired Team Member
  • Premium Supporter
  • October 5, 2004
    3,129
    1,634
    Dresden / Munich / Maastricht
    Home Country
    Germany Germany
    I've update the English languages files in TransifexCache and also re-added the string to all translations, because it got removed/cleared since Transifex handled it like a "new" string. So we did not loose any translations.
    I also pulled the translations from Transifex again and updated them in TransifexCache.

    From my pov it's fine now and only missing is
    Quotes might also be escaped if being used. Currently this is not the case, but to solve it properly we might need take care of it as well?

    Should the code be moved to a separate method where the text

    • is being trimmed
    • \' replaced by '
    • and \" replaced by "
    Or maybe wrap the code before .Replace() to a new line for better readability.

    Do you take care of it and merge the branch to dev once done?
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #7
    Change commited. Would be good to get some testing feedback first before I merge it.

    Thanks for very good teamwork (y)
     

    chefkoch

    Retired Team Member
  • Premium Supporter
  • October 5, 2004
    3,129
    1,634
    Dresden / Munich / Maastricht
    Home Country
    Germany Germany
    Everything is working nicely. The FixEncodings of TransifexHelper does not remove the back slashes anymore and within MP2 these are nicely loaded and displayed:
    20130427_235832.png

    20130427_235855.png
     

    Users who are viewing this thread

    Top Bottom