User supplied translations (1 Viewer)

JDWestoby

MP Donator
  • Premium Supporter
  • April 9, 2008
    265
    32
    68
    Poltimore, Devon
    Home Country
    United Kingdom United Kingdom
    Now I like the idea of using messages to allow for other languages. (Although I am English and by definition think everyone speaks English, which surprisingly they normally do!).

    What I "don't like" is that I can't add to the languages xml easily.

    What I have done previously is to put the strings into my own XML config so at least they CAN be translated if someone cares to do so. But it is tedious, especially as I have to label buttons etc. myself rather than let MediaPortal do it byt replacing 123 with "Hello World" or whatever.

    I now use a simple translator class which takes a string and return a translated string taken from a general Translate.xml file. This file is NEVER written and is just a user edited file.

    The only call (in VB, I like VB) is -

    Public Function Text(ByRef Value As String) As String
    Dim v As String = //get the value from the Translate.xml file using usual MP reader
    if (v = "") then Return(Value) Else return(v)

    This could be incorporated into MediaPortal without changing any of the functionality, instead of getting a message number it gets a string.

    Then I could label my buttons with <Label>Host</Label> and if there is a translation MP can apply it. No numbers, I don't know what number 'Save' is.

    Similarly I could ask MP for the translation for "Every good boy deserves favour" and if it is important to me to have this in swahili then I can go edit the Translate.xml file.

    Conversely if I get a plugin that is in (more likley) in German say, then I can go and edit the file to change what it says.

    I know it is a simple thing but there are dozens and dozens of language xml files, on every MP users system of which they use - errrrr one!

    Not a big thing I know, but thank you for reading.
     

    Users who are viewing this thread

    Top Bottom