home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
SkinTranslations
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="SilentException" data-source="post: 625518" data-attributes="member: 83924"><p>Problem: Skin authors are often forced to <strong>hard code</strong> 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.</p><p></p><p>Solution: <strong>SkinTranslations</strong> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>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:</p><p></p><p>[CODE]<?xml version="1.0" encoding="utf-8"?></p><p><!-- Skin translation file --></p><p><!-- English (US) --></p><p></p><p><strings></p><p> <!--<string Field="ExampleTranslation">Example of translated string</string>--></p><p> <!--<string Field="ExampleTranslationFromMediaPortal">874</string>--></p><p> <!-- # --></p><p> <!-- A --></p><p> <!-- B --></p><p> <!-- C --></p><p> <!-- D --></p><p> <!-- E --></p><p> <!-- F --></p><p> <!-- G --></p><p> <!-- H --></p><p> <!-- I --></p><p> <!-- J --></p><p> <!-- K --></p><p> <!-- L --></p><p> <!-- M --></p><p> <!-- N --></p><p> <!-- O --></p><p> <!-- P --></p><p> <!-- Q --></p><p> <!-- R --></p><p> <!-- S --></p><p> <!-- T --></p><p> <!-- U --></p><p> <!-- V --></p><p> <!-- W --></p><p> <!-- X --></p><p> <!-- Y --></p><p> <!-- Z --></p><p></strings>[/CODE]</p><p></p><p>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.</p><p></p><p>If user changes skin or language using GUI settings, translations are updated accordingly.</p><p></p><p>As a skin author, this is what you have to do:</p><p></p><p>1. Create folder Translations in your skin root</p><p>2. Add translation files. Default translation file is "en-US.xml"</p><p>3. Add more translation files for different languages or ask users for translations <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>That's it. Check the attachment <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /></p><p></p><p>Change log:</p><p>v0.7</p><p>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</p><p>language for mediaportal 1.2 is now read from correct place in MediaPortal.xml</p><p></p><p>v0.6</p><p>small logging fixes</p><p>added possibility for translations from MediaPortal language files</p><p></p><p>v0.5</p><p>initial release</p><p></p><p></p><p>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 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="SilentException, post: 625518, member: 83924"] Problem: Skin authors are often forced to [B]hard code[/B] 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: [B]SkinTranslations[/B] :) 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>[/CODE] 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 :) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
SkinTranslations
Contact us
RSS
Top
Bottom