Recent

Author Topic: TGIFViewer component  (Read 26488 times)

BeanzMaster

  • Sr. Member
  • ****
  • Posts: 268
Re: TGIFViewer component
« Reply #15 on: June 30, 2018, 03:21:28 pm »
Thanks wp  8-)

BeanzMaster

  • Sr. Member
  • ****
  • Posts: 268
Re: TGIFViewer component
« Reply #16 on: July 04, 2018, 12:50:23 am »
New Update available
  • Add new property : DisplayInvalidFrame. By default is set to FALSE. So the invalid frame are not displayed during the animation
  • Completly rewrite gvTranslate unit. Replaced by BZApplicationTranslator
  • Updated GifView demo. Now translation work on Linux, Windows and MacOS
  • Fix some minors bugs

Notice :
Becareful on Linux and Mac by lauching GifView inside IDE. PO files are rewritten and replaced sometimes. Don't say why.
This behaviours seems  present in Lazarus before version 1.8.4). So make a backup of the PO files before and make just a clean and build.


Best regards

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: TGIFViewer component
« Reply #17 on: July 05, 2018, 12:33:58 am »
The BZApplicationTranslator looks interesting. A few comments, though:
  • I think automatically restarting the application when the language changes is not good. Are you absolutely sure that the user isn't in the process of editing something when he suddenly decides to switch language? He won't be happy that his text will be gone when the app comes back. Do you know that language can be changed by just re-translating the resource strings? In LCLTranslator this is just using another language in SetDefaultLang. Probably you have the problem that you cannot switch back to the default language because there is no correct po file for it. Assuming that your default language is "en" just copy the "program.po" to "program.en.po". - see attached demo.
  • Multi-language does not only mean translation. You should also take care of FormatSettings. Please look at the demo in examples/translation of your Lazarus installation for some more ideas.

BeanzMaster

  • Sr. Member
  • ****
  • Posts: 268
Re: TGIFViewer component
« Reply #18 on: July 05, 2018, 02:49:13 am »
Hi,
The BZApplicationTranslator looks interesting. A few comments, though:
  • I think automatically restarting the application when the language changes is not good. Are you absolutely sure that the user isn't in the process of editing something when he suddenly decides to switch language? He won't be happy that his text will be gone when the app comes back.

Yes you're right I did not think more than that. The main author of first version "gvTranslate" had done like that, I did not pay more attention.

Do you know that language can be changed by just re-translating the resource strings? In LCLTranslator this is just using another language in SetDefaultLang. Probably you have the problem that you cannot switch back to the default language because there is no correct po file for it.

No, i don't say that. Po language are generate by POEdit. The actual problem is under Lazarus when you Execute with debug. PO are regenerated.
With one the user under linux is the gifview.xxx.po. And for me under windows is the GifViewerStrConsts.xx.po. I also had the same issue under Mac.
After compiling the gifview demo if you replace po files by the original in the archive all is correct. The only thing i'v found for prevent this is to disable i18n option in the project. And finally it does not interfere with the process of translation.

Assuming that your default language is "en" just copy the "program.po" to "program.en.po". - see attached demo.[/li]

  • Multi-language does not only mean translation. You should also take care of FormatSettings. Please look at the demo in examples/translation of your Lazarus installation for some more ideas.
Thank you for your advice I'll take a look at all this. Just a question if my default language is fr it's the same, i'm right ?

Note i've updated code once more time :
  • Add AutoRemoveInvalidFrame property, in case of corrupted frames are found, so animation is play correctly
  • Fix little render bugs. (Like with Animaux-0.gif in the "TestSuite")
  • Did some minors corrections

« Last Edit: July 05, 2018, 02:51:43 am by BeanzMaster »

BeanzMaster

  • Sr. Member
  • ****
  • Posts: 268
Re: TGIFViewer component
« Reply #19 on: July 05, 2018, 03:09:05 am »
    Assuming that your default language is "en" just copy the "program.po" to "program.en.po". - see attached demo.[/li][/list]


    I've tested and added one PO file for fr. At start IHM is in english i can change to DE or FR no problems. But I can never go back to EN. It is normal ?

    An another thing,  with Lazarus when you set your language in options we need to restart Lazarus for take in charge the new language. Under Linux, windows and Mac it is mandatory. Language of the IHM is not translate automatically and dynamically.

    So i think restart application is needed for translation in this case. Before restarting user must be notified and restart not will be automatic. This will be the best compromise that you think?
    « Last Edit: July 05, 2018, 03:18:15 am by BeanzMaster »

    wp

    • Hero Member
    • *****
    • Posts: 11853
    Re: TGIFViewer component
    « Reply #20 on: July 05, 2018, 09:03:51 am »
    I've tested and added one PO file for fr. At start IHM is in english i can change to DE or FR no problems. But I can never go back to EN. It is normal ?
    I thought this has been fixed. Anyway: Open the .en.po file (which is a direct copy of the template .po file) in peedit - you'll see untranslated items. Go to every untranslated line and press CTRL-B to copy the original string into the translated column. Of course, both strings are the same here.
    « Last Edit: July 05, 2018, 09:08:38 am by wp »

    wp

    • Hero Member
    • *****
    • Posts: 11853
    Re: TGIFViewer component
    « Reply #21 on: July 05, 2018, 10:15:15 am »
    if my default language is fr it's the same, i'm right ?
    What exactly is "default language"? I think for the purpose of preparing multi-language applications it is the language in which you add resource strings. You seem to add resource strings in French. Therefore the template file .po contains French strings. Copy it to .fr.po and copy all untranslated strings to the translated column by pressing CTRL+B in poedit. Create an English file .en.po, have someone add the english translations, etc. So "default language" does not matter here much, except for the language file which contains the originally untranslated texts.

    The next time when "default language" comes into play is when your program starts. LCLTranslator looks up in the OS and finds that your OS is in french. Therefore it picks the .fr.po file as default at start.

    As for the FormatSettings, default language should not be important at all. The problem with the translation project in the Lazarus examples folder is that there does not seem to be a cross-platform way to detect the correct FormatSettings for all OSs. Therefore, the code is mostly IFDEFed with {$IFDEF Windows}

    BeanzMaster

    • Sr. Member
    • ****
    • Posts: 268
    Re: TGIFViewer component
    « Reply #22 on: July 05, 2018, 04:02:53 pm »
    if my default language is fr it's the same, i'm right ?
    What exactly is "default language"? I think for the purpose of preparing multi-language applications it is the language in which you add resource strings. You seem to add resource strings in French. Therefore the template file .po contains French strings. Copy it to .fr.po and copy all untranslated strings to the translated column by pressing CTRL+B in poedit. Create an English file .en.po, have someone add the english translations, etc. So "default language" does not matter here much, except for the language file which contains the originally untranslated texts.

    The next time when "default language" comes into play is when your program starts. LCLTranslator looks up in the OS and finds that your OS is in french. Therefore it picks the .fr.po file as default at start.

    See the attached screenshots  How do you explain this ? My OS Language is French (fr) so why i can't come back to en and Why fr is not selected like you said when i'm launch the application  ?

    Note I'm just do the fr.po, added header in en.po. And in radiogroup just add fr item that's it. Application was generated just by doing a "Clean and Build"

    As for the FormatSettings, default language should not be important at all. The problem with the translation project in the Lazarus examples folder is that there does not seem to be a cross-platform way to detect the correct FormatSettings for all OSs. Therefore, the code is mostly IFDEFed with {$IFDEF Windows}

    I know that and it's normal we must  use {$IFDEF} in this case or write special procedure for translate
    « Last Edit: July 05, 2018, 04:05:46 pm by BeanzMaster »

    BeanzMaster

    • Sr. Member
    • ****
    • Posts: 268
    Re: TGIFViewer component
    « Reply #23 on: July 05, 2018, 04:03:29 pm »
    Anim of you sample

    wp

    • Hero Member
    • *****
    • Posts: 11853
    Re: TGIFViewer component
    « Reply #24 on: July 05, 2018, 04:34:33 pm »
    Your English translation file is empty.

    Well then maybe the "default language" is English - as I said I don't know what this means here... Copy the project1.po to project1.en.po and open that in poedit. Click in every line and press CTRL+B to copy each original resource string into the translated column. Now the english po file has translations, and everything must work.

    See also attached demo.
    « Last Edit: July 06, 2018, 01:25:05 pm by wp »

    BeanzMaster

    • Sr. Member
    • ****
    • Posts: 268
    Re: TGIFViewer component
    « Reply #25 on: July 07, 2018, 12:28:58 am »
    Your English translation file is empty.

    Well then maybe the "default language" is English - as I said I don't know what this means here... Copy the project1.po to project1.en.po and open that in poedit. Click in every line and press CTRL+B to copy each original resource string into the translated column. Now the english po file has translations, and everything must work.

    See also attached demo.

    Thanks wp and sorry, i didn't understand well the first time. Now i'm ok

    BeanzMaster

    • Sr. Member
    • ****
    • Posts: 268
    Re: TGIFViewer component
    « Reply #26 on: July 07, 2018, 12:36:44 am »
    New update available :
    • Improved French to English translation
    • Improved translation in GifView demo. Now not need to restart application
    • Added RawFrames[] property for gain access to each frame informations in the gif like the comments
    • Added comments view in GifView demo
    • Corrected some misspelled words in the code

    Direct download : https://github.com/jdelauney/TGIFViewer/archive/master.zip

    EDIT : TGIFViewer is also available in Online Package Manager. Thank you very much GetMem  8-)
    « Last Edit: July 07, 2018, 12:40:01 pm by BeanzMaster »

    BeanzMaster

    • Sr. Member
    • ****
    • Posts: 268
    Re: TGIFViewer component
    « Reply #27 on: November 03, 2018, 03:34:22 pm »
    New update available

    Fix a little bug in "Application Extension" reading

    Best regards

    Sergey Tkachenko

    • New Member
    • *
    • Posts: 36
      • TRichView
    Re: TGIFViewer component
    « Reply #28 on: November 05, 2018, 02:54:15 pm »
    Do you plan to implement a graphic class (inherited from TGraphic)?

    BeanzMaster

    • Sr. Member
    • ****
    • Posts: 268
    Re: TGIFViewer component
    « Reply #29 on: November 05, 2018, 06:01:10 pm »
    Hi, Sergey

    No because, animations will not be supported.
    For a GIF with just a single image, it's not a problem for making loader derived from FP-Image, it's easy.
    If you want to use TGraphic, actualy, from TGifViewer you can easly extract each frames to TBitmap.
    For supporting animations, in all case,  i'll must do a special child of TImage, so.

    In a near future, i plan to make a Delphi version for VCL and FMX.

    Since severals month, i'm working on an alternative to TBitmap. It's totally independant of FPC and Lazarus. Is better,  faster, easier and more stable.
    I think the bitmap managment of FPC/Lazarus need to be rewriting, because actually it'a have many things that not work correctly.

    Best regards


     

    TinyPortal © 2005-2018