Language Converter between MP1 and MP2

Discussion in 'Plugin Development' started by huha, September 8, 2012.

  1. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    I have written a simple language converter which you can use to translate language files between MP1 and MP2.
    I originally used it to maintain a golden language source in MP1 and derive all MP2 language files.
    Now I am using it more to get the transifex MP2 language files and reconvert it back into MP1.

    The usage is very simple:
    All .xml files from the Input folder will be converted into language files into the output folder. A backup is generated.

    The Easter built MP2 did support the old MP2 language format (no more needed)

    The source code is attached. I am not planning to support this program, but thaught it could be useful as is for others, too.

    Just one more comment:
    If you use a comment in yourMP1 language file
    <!-- MP2STR:CreateTvWish -->
    <String id="200">Create Tv Wish</String>

    Then the string in MP2 will be for a plugin name "TvWishListMP2" TvWishListMP2.CreateTvWish and not
    TvWishListMP2.200.

    In also works the other way for a MP2 language file
    <!-- MP1STR:200 -->
    <string name="TvWishListMP2.CreateTvWish">Create Tv Wish</string>
    the MP1 string will be 200.

    The .exe program is in MP2LanguageConverter.Program.zip.

    The source code is in MP2LanguageConverter.zip

    Have fun, huha



    Update: New version uploaded on 17. Sept. 2012

    Update: New version uploaded on 05. Nov. .2012

    Update: New version uploaded on 25.November 2012 and included Source Code for FillFromLanguageFile
     

    Attached Files:

    Last edited: November 25, 2012
    • Like Like x 3
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    I updated the language converter for translating Transifex MP2 language files back to MP1 language files.
    - the transifex line return will now be converted into 2 charcters "\n"
    - updated the program to handle partial language files not fully translated
     
  4. chefkoch
    • Premium Supporter

    chefkoch Retired Team Member

    Joined:
    October 5, 2004
    Messages:
    3,130
    Likes Received:
    1,456
    Gender:
    Male
    Location:
    Dresden / Munich / Maastricht
    Ratings:
    +1,773 / 1
    Home Country:
    Germany Germany
    We implemented some code in the TransifexHelper to apply some fixes after pulling translations from Transifex.
    Maybe this also helps you within the converter.
    https://github.com/MediaPortal/Medi...aPortal/Tools/TransifexHelper/Program.cs#L339
     
    • Like Like x 1
  5. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    I updated the language converter and added the conversion for \' as shown in the TransifexHelper program.
    chefkoch, I realized that the Transifex helper does not contain an encoding for the newline character from transifex, but you may not need this.
    I had to convert the transifex newline character 9166 by

    Char transifexreturnline_char = Convert.ToChar(9166);
    myline = myline.Replace(transifexreturnline_string, @"\n");

    Transifex will interprete in a string the two characters "\n" as a newline and convert it into a single character 9166.

    I also added a log file, a flexible input file and a silent mode.
    So the user can now enter
    MP2LanguageConverter.exe <inputfile> PROCESS

    Inputfile is the parameterfile and must have been generated by an old run of MP2LanguageConverter.exe, where the parameters are saved in MP2LanguageConverter.txt after exiting the program.
     
    • Like Like x 1
  6. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    I did another minor update and included the source code for a small program to fill an incomplete MP2 language file with the missing strings from a golden resource.
    In the TvWishList Transifex Posting you can see an example for how to use these little programs to download the langugae files from transifex, convert into MP1 or MP2 language files and install it in the MP1 or MP2 or Tvserver plugin folders.
     
    Last edited: November 25, 2012
    • Like Like x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!