progressivetech / net.ourpowerbase.qrcodecheckin

QRCode Checkin allows you to send an email that contains a scanable code to the registered participants for your event.
Other
16 stars 15 forks source link

Translate the extension to another language #12

Open rubofvil opened 3 years ago

rubofvil commented 3 years ago

Currently isn't working the translations of the extension. Could we work to fix the translations?

Could we add the translations in transifex?

jmcclelland commented 3 years ago

Thanks - I've merged your changes. What steps do I need to take to get things started on the transifex site?

mariav0 commented 3 years ago

I am wondering if the supporting text could be outsourced so that we are able to specify our own text in a chosen language. It would be great to have another token without the supporting text (qr code only) for people who want to decide themselves what exactly should be written there.

rubofvil commented 3 years ago

There is in Transifex and have some translations available(Catalan, Dutch, Spanish) https://www.transifex.com/civicrm/civicrm_extensions/qrcodecheckin/

You can compile and add in the repo the mo files, to have directly the translations available in the github

/l10n/es_ES/LC_MESSAGES/.po Or will be generated in a future to download , over this urls https://download.civicrm.org/civicrm-l10n-extensions/mo/qrcodecheckin/es_ES/qrcodecheckin.mo Refs https://docs.civicrm.org/dev/en/latest/extensions/publish/#translation https://docs.civicrm.org/dev/en/latest/extensions/translation/#for-developers-generate-po-and-mo-files-for-your-extension *Replacing es_ES by the language
jmcclelland commented 3 years ago

@mariav0 - Now, thanks to rubofvil's changes, the text sent by email is passed through the translate function. And, you have the option of just sending a link to the qr code. However, there is no option to send just the image. I think that belongs in a separate issue. Would you mind opening a new issue for that feature request?

jmcclelland commented 3 years ago

@rubofvil - I'm still having some trouble. I'm getting a 404 not found error when I go to: https://download.civicrm.org/civicrm-l10n-extensions/mo/qrcodecheckin/es_ES/qrcodecheckin.mo and no luck with this URL either: https://www.transifex.com/civicrm/civicrm_extensions/qrcodecheckin/

Also, thanks for sending the links to the docs. Based on these instructions it seems that we should have /l10n/qrcodecheckin.pot but instead we have: /l10n/net.ourpowerbase.qrcodecheckin.pot. Could that be the problem?

mariav0 commented 3 years ago

@jmcclelland I've opened a new issue therefore, thanks! You can find it here.

rubofvil commented 3 years ago

@rubofvil - I'm still having some trouble. I'm getting a 404 not found error when I go to: https://download.civicrm.org/civicrm-l10n-extensions/mo/qrcodecheckin/es_ES/qrcodecheckin.mo and no luck with this URL either: https://www.transifex.com/civicrm/civicrm_extensions/qrcodecheckin/

Also, thanks for sending the links to the docs. Based on these instructions it seems that we should have /l10n/qrcodecheckin.pot but instead we have: /l10n/net.ourpowerbase.qrcodecheckin.pot. Could that be the problem?

With your last validation of the extension in CiviCRM seems that is working the download of the mo. Thx! https://download.civicrm.org/civicrm-l10n-extensions/mo/qrcodecheckin/es_ES/qrcodecheckin.mo

jmcclelland commented 3 years ago

Great! So... should I be adding the .mo file to the extension's git repo? Or is it better to let people download it automatically?

Guydn commented 11 months ago

Is there any update on that issue since 2021 ? With the .mo ?

jmcclelland commented 11 months ago

No - I never got an answer to my last question. I only use the extension in english - if you can figure out the next step to support other languages I am happy to implement but I don't have the resources to push this forward on my own.

Guydn commented 11 months ago

I am currently asking to somebody who is more "technical". Not 100% sure. Which resources would you need ?

jmcclelland commented 11 months ago

Time. I need someone else to do the labor.

rubofvil commented 11 months ago

No - I never got an answer to my last question. I only use the extension in english - if you can figure out the next step to support other languages I am happy to implement but I don't have the resources to push this forward on my own.

Sorry, I missed the response. We are using currently the translations, added some examples of use. But it would be great if you could add the mo files directly to the extension.

Example of use with "drush make"

libraries[net.ourpowerbase.qrcodecheckin][destination] = ""
libraries[net.ourpowerbase.qrcodecheckin][directory_name] = "files/civicrm/ext/net.ourpowerbase.qrcodecheckin"
libraries[net.ourpowerbase.qrcodecheckin][download][type] = "git"
libraries[net.ourpowerbase.qrcodecheckin][download][url] = "https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin.git"
libraries[net.ourpowerbase.qrcodecheckin][download][working-copy] = "true"
libraries[net.ourpowerbase.qrcodecheckin][download][tag] = "2.0.0"
libraries[qrcodecheckin_l10n][destination] = ""
libraries[qrcodecheckin_l10n][directory_name] = "files/civicrm/ext/net.ourpowerbase.qrcodecheckin/l10n/ca_ES/LC_MESSAGES"
libraries[qrcodecheckin_l10n][download][type] = "get"
libraries[qrcodecheckin_l10n][download][url] = "https://download.civicrm.org/civicrm-l10n-extensions/mo/qrcodecheckin/ca_ES/qrcodecheckin.mo"

Example of use with composer

{
  "name": "....",
  "description": "...",
  "require": {
    "civicrm/qrcodecheckin": "2.0.0",

    ....
  },
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "civicrm/qrcodecheckin",
        "type": "civicrm-extension",
        "version": "2.0.0",
        "source": {
          "type": "git",
          "url": "https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin.git",
          "reference": "2.0.0"
        }
      },
      .....
    }
  ],
  "scripts": {
    "post-install-cmd": [
      "@qrcodecheckin_translation"
    ],
    "post-update-cmd": [
      "@qrcodecheckin_translation"
    ],
    "qrcodecheckin_translation": [
      "mkdir -p files/civicrm/ext/qrcodecheckin/l10n/es_ES/LC_MESSAGES/ | wget -O files/civicrm/ext/qrcodecheckin/l10n/es_ES/LC_MESSAGES/qrcodecheckin.mo http://download.civicrm.org/civicrm-l10n-extensions/mo/qrcodecheckin/es_ES/qrcodecheckin.mo"
    ]
  },

}
jmcclelland commented 11 months ago

Thanks @rubofvil for the details. I feel like I am getting pedantic but want to be sure I do this right.

You said it would be great if I added the translation files directly to the repo but... you also provided drupal make and composer snippets. Those snippets seem to suggest that translation files should be pulled in at installation time and therefore I should not commit them (because they could become stale).

Instead, I should ensure that my POT file is up to date and count on people installing my extension to either download the appropriate language files via their build process or use an extension like uplang.

I also don't see any .mo files in any of the common extensions I use.

Does that sound right?

rubofvil commented 11 months ago

@jmcclelland this is a good discussion.

There are no clear criteria for how to publish translations.

The alternative you mention of https://lab.civicrm.org/extensions/uplang is good, there is a versioning problem on the translations and the user has to install that extra extension, but it is a good option.

It is extra work to add the translations in the repo itself, but it can give the benefit of versioning. It could be included with a CI from github itself, every time a tag is placed, the translation will be downloaded. But it is true that it is not a definite criterion and it is a work that perhaps should be done by the side that downloads/uses the extension.

Both options seem good