Plugin translations workflow questions

So, on Foreman HackDay we at ATIX finally managed to start working on translations for our two plugins.
Thanks to @aruzicka for giving support and creating a new sub-project on Transifex for Foreman SCC Manager.

Some questions occurred however, which we like to put up for discussion here:

  1. It seems that plugins should be translated as sub-projects to the Foreman Transifex Project.
    However, it is not clear to us, how the upload process for new .pot files should be. The Plugin Guide as well as the Translation Guide state, that Transifex will pull them automatically from the Github-repo. Is this also true for the sub-projects and if so, where to put the URL?

  2. While generating the translations we noticed that quite a few strings where added to the .pot file that are not within the plugin, but seem to come from katello, foreman or any other plugin that has been added to the foreman-instance. Should these strings be manually removed from the .pot-file or is there a way to keep them out of it in the first place.

  3. We are not sure what the locale/action_names.rb file is for, but the fact that the entries are not sorted, does not add to the readability of the diff when the translation files are updated. Granted this is probably nitpicking :wink:

I think at least the Plugin Guide has to be updated to state the workflow how/where to create a new Transifex (Sub-)project in order to get translations for plugins going more easily.

Thanks

1 Like

I will just add the example we are working on here:
https://github.com/ATIX-AG/foreman_scc_manager/pull/24

To at least partially answer 2 and 3:

Most of plugins which use foreman-tasks add their own Actions, which should inheirt from Actions::EntryAction. Actions can have so called humanized_name, which is the thing which is shown in Monitor > Tasks in the Action column. The issue with those is they are highly dynamic and can’t be extracted using the regular gettext workflow. To have them translated, we extend the string extraction rake task to take all subclasses of Actions::EntryAction, allocate them and take their humanized_names. Then we put all the collected humanized_names and put them into the locale/action_names.rb file, from which they can be picked up by gettext.

Strings from other plugins show up, because taking subclasses of a class doesn’t know anything about plugins. To put it another way, because of the humanized_name extraction mechanism for actions, when you extract strings from a plugin, you get strings for all actions from all currently enabled plugins.

Hey, this is set in the Transifex main project, you do need admin rights to see it however when the subproject is added I can set the URL easily for you. Example URL: https://raw.githubusercontent.com/theforeman/foreman_discovery/develop/locale/foreman_discovery.pot

Makes sense.
For SCC Manager this would then be https://raw.githubusercontent.com/ATIX-AG/foreman_scc_manager/master/locale/foreman_scc_manager.pot
And for Foreman Snapshot Management (sub-project still needs to be created): https://github.com/ATIX-AG/foreman_snapshot_management/blob/master/locale/foreman_snapshot_management.pot

thanks

I don’t see this project yet. I have set the other one (scc_manager) and it should be picking it up from now on.

1 Like

Let me know when to set it.

Yes, it has not been created in Foreman’s Transifex project, yet.
Would you please create a project for foreman_snapshot_management, so we can get translations going for that plugin, too?

Oh right I can do that as well. Done, it’s both up and updating.

1 Like

For the katello issues, any plugin loaded will get extracted. I suggest you unload as many other plugins as possible before you run the extract commands.

Thanks, I will try that.

Another question, in what interval does transifex pull new changes?
We did commit the new pot-file to foreman_scc_mager 2 days ago, but transifex shows last source-update to be 8 days ago (which was when Adam manually uploaded it).

The Transifex documentation states the following, maybe that is a problem:

Authenticate to GitHub and choose one or more repositories to make visible in Transifex. Authentication and repository selection on Github should be done by an owner (admin) of the account.

The scc manager link in transifex was wrong. I changed it to https://raw.githubusercontent.com/ATIX-AG/foreman_scc_manager/master/locale/foreman_scc_manager.pot and it should work now.

2 Likes

Thanks, do we need to push a new version of the file? Right now it still displays ‘Oct 17th, 2019’.

Could I ask you to take a look at foreman_snapshot_management-resource as well?

Looks like the .pot file for foreman_snapshot_management resource has not been updated - it is empty and looks like the one from the plugin tempate:

Yes, the PR to fix the translation had not been merged.
I just merged it :slight_smile:

Let check tomorrow to see if it has been updated. The links look correct:

https://raw.githubusercontent.com/ATIX-AG/foreman_scc_manager/master/locale/foreman_scc_manager.pot

https://raw.githubusercontent.com/ATIX-AG/foreman_snapshot_management/master/locale/foreman_snapshot_management.pot