Module translations

  • 4 Replies
  • 748 Views
  • Publish
    Module translations
    « on: 02 / June / 2012, 14:50:56 »
    Advertisements
    Hi,

    I've worked hard this week and finished now a patch, that adds a way to translate modules without the main CHDK, so that every module can have its own translation and is so more usable on other builds with changed main translation. Also it (should) save memory if every translation, that is only needed by one module is moved to an extra file and only loaded if needed (with the module).

    The attached patch makes all necessary changes and uses for calendar and 4wins the new feature, it also adds translations for sudoku.

    Warning: it's only a test version and gives a compiler warning ("to many empty lines ...") because I haven't re numerated the main translation. You can't apply this patch with CHDKshell (I have no idea why), but with tortoise it's no problem. The translations are only made for German and English. If you choose another language the default (if available) or English is used.

    Please test and comment.

    Edit: The patch is for rev. 1882/1890 (oter versions not tested)
    « Last Edit: 02 / June / 2012, 15:25:00 by TobiMarg »

    *

    Offline philmoz

    • *****
    • 2936
      • Photos
  • Publish
    Re: Module translations
    « Reply #1 on: 02 / June / 2012, 21:43:48 »
    Haven't tried it yet; but there is likely to be an issue with the module language file names on some cameras - the path + filename will exceed the 32 character limit.

    Phil.

    CHDK ports:
      sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
      g12 (1.00c, 1.00e, 1.00f & 1.00g)
      sx130is (1.01d & 1.01f)
      ixus310hs (1.00a & 1.01a)
      sx40hs (1.00d, 1.00g & 1.00i)
      g1x (1.00e, 1.00f & 1.00g)

  • Publish
    Re: Module translations
    « Reply #2 on: 04 / June / 2012, 07:56:11 »
    If there is really a problem with the path length the filename / path could be changed form
    "A/CHDK/LANG/<modulename>/<modulename>.<langname>.lng" (18 + 2*~8 [modulename] + ~8 [langname] = 42)
    to
    "A/CHDK/LANG/<modulename>/<langname>.lng" (18 + ~8 [modulename] + ~8 [langname] = 34).
    And if that also doesn't works we could remove the ".lng".
    I have no other idea, because if we give every module a key (e.g. calendar = "v7d" and connect 4 = "m93") then we need 2 things that are unique to every module (name, key) and one of them is fixed at compile time (key) so the module sharing doesn't work so good.

    *

    Offline philmoz

    • *****
    • 2936
      • Photos
  • Publish
    Re: Module translations
    « Reply #3 on: 05 / June / 2012, 19:10:14 »
    One thought, most modules would have only a small number of translated strings so perhaps for the modules you could have a single language file with different sections for each language.

    You could then either load them all or scan the file to find the one you need.

    If performance is a problem you could convert the entire language file to code and compile it into the module at build time; but this would stop you from editing the translations on the fly.

    Phil.
    CHDK ports:
      sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
      g12 (1.00c, 1.00e, 1.00f & 1.00g)
      sx130is (1.01d & 1.01f)
      ixus310hs (1.00a & 1.01a)
      sx40hs (1.00d, 1.00g & 1.00i)
      g1x (1.00e, 1.00f & 1.00g)


  • Publish
    Re: Module translations
    « Reply #4 on: 06 / June / 2012, 07:58:16 »
    ... so perhaps for the modules you could have a single language file with different sections for each language.
    That's a good idea I will try to implement it.

    If performance is a problem you could convert the entire language file to code and compile it into the module at build time; but this would stop you from editing the translations on the fly.
    I think performance is a smaller problem than memory (actually the default language is compiled into the main CHDK / module), but we could make a new program to merge translations and write offsets for all languages where we could seek to and load the right strings.

     

    Related Topics