Archive: NSISDL suggest for /TRANSLATE


NSISDL suggest for /TRANSLATE
Hello!

I am using this code with NSISDL

!ifdef LANG_SPANISH
  • LangString T1 ${LANG_SPANISH} "Descargando: %s"
    LangString T2 ${LANG_SPANISH} "Conectando ..."
    LangString T3 ${LANG_SPANISH} "segundo"
    LangString T4 ${LANG_SPANISH} "minuto"
    LangString T5 ${LANG_SPANISH} "hora"
    LangString T6 ${LANG_SPANISH} "s"
    LangString T7 ${LANG_SPANISH} "%dkB (%d%%) / %dkB @ %d.%01dkB/s"
    LangString T8 ${LANG_SPANISH} " (Restante: %d %s%s)"
!endif

Section "One"
  • NSISDL::Download /TRANSLATE $(T1) $(T2) $(T3) $(T4) $(T5) $(T6) $(T7) $(T8) /TIMEOUT=3000 "$1" "$2"

    Pop $R0 ;Get the return value
    StrCmp $R0 success DownloadOK

    DetailPrint "Error downloading: $1"
    Abort

    DownloadOK:

    The Next Code....
EndSection

I suggest the creator of NSISDL, that NSISDL accept a single parameter (multiple) for /TRANSLATE, and then breakdown. Something like the following:

Quote:

!ifdef LANG_SPANISH
  • LangString T1 ${LANG_SPANISH} "Descargando: %s"
    LangString T2 ${LANG_SPANISH} "Conectando ..."
    LangString T3 ${LANG_SPANISH} "segundo"
    LangString T4 ${LANG_SPANISH} "minuto"
    LangString T5 ${LANG_SPANISH} "hora"
    LangString T6 ${LANG_SPANISH} "s"
    LangString T7 ${LANG_SPANISH} "%dkB (%d%%) / %dkB @ %d.%01dkB/s"
    LangString T8 ${LANG_SPANISH} " (Restante: %d %s%s)"

    LangString NSISDL_TRADUCTION ${LANG_SPANISH} '"$(T1)" "$(T2)" "$(T3)" "$(T4)" "$(T5)" "$(T6)" "$(T7)" " $(8)"'
!endif

Section "One"
  • NSISDL::Download /TRANSLATE $(NSISDL_TRADUCTION) /TIMEOUT=3000 "$1" "$2"

    Pop $R0 ;Get the return value
    StrCmp $R0 success DownloadOK

    DetailPrint "Error downloading: $1"
    Abort

    DownloadOK:

    The Next Code....
EndSection This will make effective use of translation through !include nsisdl.nsh, in order to check the status of the downloads, without having to use a !insertmacro, losing the status of the download, for further verification.


Thank you for reading the message!


Apologies if this is not the right place for the message.

You can easily convert it to one parameter while keeping NSISdl backward compatible and with semi-clean code.

!define NSISdl_trans /TRANSLATE '"$(T1)" "$(T2)" "$(T3)" "$(T4)" "$(T5)" "$(T6)" "$(T7)" " $(8)"'
NSISdl::download ${NSISdl_trans} http://... $TEMP\...

Rightly did not work. Many Thanks for the help kichik!

Greetings!