SkinTranslations (1 Viewer)

SilentException

Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    Problem: Skin authors are often forced to hard code strings in their skins for the plugins that do not support localization or for the various strings they see fit in the skin but the string isn't available in standard MediaPortal localization strings. Being a skinner myself, i hated that, something had to be done.

    Solution: SkinTranslations :)

    This is a *very* simple plugin and I'm surprised no one has done it before (excuse me if I'm wrong). Basically it'll look for "Translations" folder in your skin folder, match localization from MediaPortal configuration and look for proper translation XML file. If that one doesn't exist, English is used as default (as always). You can then access the translated strings using GUI properties like this: #SkinTranslation.Translations.*FIELD*.Label where *FIELD* is to be replaced with the value from translation XML. Example translation XML looks like this:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Skin translation file -->
    <!-- English (US) -->
    
    <strings>
    	<!--<string Field="ExampleTranslation">Example of translated string</string>-->
    	<!--<string Field="ExampleTranslationFromMediaPortal">874</string>-->
    	<!-- # -->
    	<!-- A -->
    	<!-- B -->
    	<!-- C -->
    	<!-- D -->
    	<!-- E -->
    	<!-- F -->
    	<!-- G -->
    	<!-- H -->
    	<!-- I -->
    	<!-- J -->
    	<!-- K -->
    	<!-- L -->
    	<!-- M -->
    	<!-- N -->
    	<!-- O -->
    	<!-- P -->
    	<!-- Q -->
    	<!-- R -->
    	<!-- S -->
    	<!-- T -->
    	<!-- U -->
    	<!-- V -->
    	<!-- W -->
    	<!-- X -->
    	<!-- Y -->
    	<!-- Z -->
    </strings>

    In that example, #SkinTranslation.Translations.ExampleTranslation.Label would give you "Example of translated string" in the skin and #SkinTranslation.Translations.ExampleTranslationFromMediaPortal.Label would give you "Episode" in the skin (the string is taken from MediaPortal language files.

    If user changes skin or language using GUI settings, translations are updated accordingly.

    As a skin author, this is what you have to do:

    1. Create folder Translations in your skin root
    2. Add translation files. Default translation file is "en-US.xml"
    3. Add more translation files for different languages or ask users for translations :)

    That's it. Check the attachment ;)

    Change log:
    v0.7
    english translations are now loaded first, user language translation after that; this ensures that even if language is out of date, english translations will still be loaded
    language for mediaportal 1.2 is now read from correct place in MediaPortal.xml

    v0.6
    small logging fixes
    added possibility for translations from MediaPortal language files

    v0.5
    initial release


    Note: this plugin is not designed for the end users. It's created for skin authors to distribute it with their skins. End users will just enjoy the results :)
     

    Attachments

    • SkinTranslations v0.5.rar
      5.8 KB
    • SkinTranslations v0.6.rar
      5.8 KB
    • SkinTranslations v0.6 For MediaPortal 1.2 Beta Only.rar
      5.9 KB
    • SkinTranslations v0.7.rar
      6 KB
    • SkinTranslations v0.7 For MediaPortal 1.2 Beta Only.rar
      5.8 KB

    trevor

    Portal Pro
    October 17, 2006
    1,600
    950
    Chelmsford
    Home Country
    United Kingdom United Kingdom
    Re: SkinTranslations v0.5

    Hi,

    Good plugin idea, we have something similar built into the Config plugin for StreamedMP and was thinking it may have wider appeal but this does a better job.

    One addition we have added and you may want to consider, if you enter a numeric as the translation then the plugin does a lookup on the MePo language file and set the property to that.

    This gives you the ability to join MePo translations together, which is currently not possible if using just the numerics

    eg

    we have these in the StreamedMP translation files

    Code:
    <string Field="#StreamedMP.Episode">874</string>
    <string Field="#StreamedMP.Series">3019</string>

    which means we can do things like this
    Code:
            <label>#StreamedMP.Series: #infoservice.recentlyAdded.series1.season #StreamedMP.Episode: #infoservice.recentlyAdded.series1.episodenumber</label>

    Series and Episode are then translated to the correct language.


    Thanks
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    • Thread starter
    • Moderator
    • #3
    Re: SkinTranslations v0.5

    Hi trevor,

    very nice suggestion. Plugin and documentation are now updated to version 0.6 with that functionality added.

    Thanks,
    SE
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    • Thread starter
    • Moderator
    • #4
    Hi, I have added new attachment in first post. This version is compatible with MediaPortal 1.2 Beta ONLY! There are no other changes.

    Use v0.6 for stable MediaPortal 1.1.* versions or 1.2 Alpha.
    Use new v0.6 for MediaPortal 1.2 Beta and above.
     

    SixSox

    Portal Pro
    May 28, 2008
    96
    46
    Copenhagen
    Home Country
    Denmark Denmark
    Hi,
    version 0.7 don't work with MediaPortal 1.2.3
    is there a chance for an update.
    v0.7 For MediaPortal 1.2 Beta worked fine
    Sorry​
    Thank you
    Sixsox
     
    Last edited:

    Users who are viewing this thread

    Top Bottom