supplierdeeply

default script and languages

  • 7 Replies
  • 793 Views
*

Offline reyalp

  • ******
  • 10536
  • Publish
    default script and languages
    « on: 14 / May / 2017, 18:43:52 »
    Advertisements
    Prompted by https://chdk.setepontos.com/index.php?topic=8085.msg132522#msg132522 from dmitrys, I've updated the default.lua script to work on some newer propsets.

    I tried to preserve the behavior of the existing script, with the exception that the IDs/values must be defined for each language explicitly. I also changed the code page for english to be 1252 instead of 1250 as it was in the old script, since 1252 is the default for CHDK builds (and more appropriate AFAIK).

    I have reservations about this being the default script at all. It's kind of convenient, but having the CHDK language potentially change when you press the shutter in alt mode for the first time seems not very user friendly, and it's highly camera dependent. This script came from CHDK-DE in the CHDK/CHDK-DE merge and hasn't been updated significantly since. I'm unclear on the history before that.

    My preference would be for the default script to just print a message along the lines of
    "This is the default script"
    "Press SET to load a script"
    "Exit alt mode to shoot"

    Some background links:
    Language settings in general https://chdk.setepontos.com/index.php?topic=2761.0
    A previous request to add more languages, and possible alternative from srsa_4c https://chdk.setepontos.com/index.php?topic=650.msg128471#msg128471


    Script behavior
    Camera language - CHDK language - Result
    Known Any CHDK language changed to camera language (or unchanged if already the same)
    Unknown Known CHDK language unchanged
    Unknown Unknown CHDK language changed to default

    Known language = one of English, German, Russian. (I may add a few more see below)
    CHDK default language = English for standard autobuild, German for CHDK-DE

    If the propset is not one of the defined propsets, the script now prints
    "unsupported propset N" and treats the camera language as unknown.

    If the propset is known, but the value is not one of the known languages, it prints
    "unknown language N:M" where N is propset ID, and M is the language value and the treats the camera language as unknown.

    I verified the values for propset 1 (a540),2 (d10), 5 (sx160), 6 (elph130) and 7 (g7x). I have assumed that 3 and 4 are the same as 2. The IDs are almost certainly the same, but the values might be different.

    edit:
    in r4809, I added definitions for all the CHDK languages. It's possible I got some of the code pages wrong, I used the following for reference
    http://www.science.co.il/language/Character-sets.php
    http://scratchpad.wikia.com/wiki/Character_Encoding_Recommendation_for_Languages

    The script uses language file name to detect and the CHDK language, which is fragile since some of them are longer than 8.3 and may be in upper or lower case. The script now attempts to account for this.

    A few CHDK languages don't appear in any Canon firmware I have.
    « Last Edit: 15 / May / 2017, 00:03:57 by reyalp »
    Don't forget what the H stands for.

  • Publish
    Re: default script and languages
    « Reply #1 on: 18 / May / 2017, 17:29:43 »
    It's nice to know that at least some of my posts on this forum are getting attention  :P

    Wouldn't using the video language propcase (#196 in propset 1) resolve the value discrepancy issue?
    Author of CHIMP, Canon Hack Installation and Management Platform

    *

    Offline reyalp

    • ******
    • 10536
  • Publish
    Re: default script and languages
    « Reply #2 on: 19 / May / 2017, 17:34:50 »
    Wouldn't using the video language propcase (#196 in propset 1) resolve the value discrepancy issue?
    I don't follow. The values are different for different propsets. The cameras later cameras have more languages, and the values are in different order.
    Don't forget what the H stands for.

  • Publish
    Re: default script and languages
    « Reply #3 on: 21 / May / 2017, 09:09:48 »
    I see that you're already using that. Foot in mouth once again.
    Author of CHIMP, Canon Hack Installation and Management Platform


  • Publish
    Re: default script and languages
    « Reply #4 on: 21 / May / 2017, 09:18:17 »
    Here's a patch for the latest and greatest default.lua to display the hint in the proper language for Russian and Ukrainian.

    lang1251.lua goes in CHDK/LUALIB.

    P.S. The latter seems to have lost its intended encoding in transit (should be 1251, obviously).
    « Last Edit: 21 / May / 2017, 09:22:46 by dmitrys »
    Author of CHIMP, Canon Hack Installation and Management Platform

  • Publish
    Re: default script and languages
    « Reply #5 on: 21 / May / 2017, 09:36:43 »
    Since the encoding doesn't matter, the separate lang1251.lua may be omitted.
    Author of CHIMP, Canon Hack Installation and Management Platform

  • Publish
    Re: default script and languages
    « Reply #6 on: 25 / May / 2017, 15:02:48 »
    Since the encoding doesn't matter, the separate lang1251.lua may be omitted.
    However, it may be worth to leave it as initially proposed for the sake of readability.
    Author of CHIMP, Canon Hack Installation and Management Platform

    *

    Offline reyalp

    • ******
    • 10536
  • Publish
    Re: default script and languages
    « Reply #7 on: 25 / May / 2017, 23:20:24 »
    Since the encoding doesn't matter, the separate lang1251.lua may be omitted.
    However, it may be worth to leave it as initially proposed for the sake of readability.
    Thanks. Added in trunk 4813. I think it's better not to make the default script depend on multiple files.
    Don't forget what the H stands for.


     

    Related Topics