DMPRoadmap / roadmap

DCC/UC3 collaboration for a data management planning tool
MIT License
102 stars 109 forks source link

rake gettext:find not collecting everything #1339

Closed briri closed 6 years ago

briri commented 6 years ago

The rake gettext:find task doesn't seem to be picking up everything.

The following 'Private: ...' section is not found in the app.pot file but the 'Organisation:' and 'Private:' ones are.

    <div class="form-group col-xs-8">
      <div class="radio">
        <%= f.label :visibility_privately_visible, raw("#{f.radio_button :visibility, :privately_visible}\
        #{_('Private: visible to me, specified collaborators and administrators at my organisation')}") %>
      </div>
      <div class="radio">
        <%= f.label :visibility_organisationally_visible, raw("#{f.radio_button :visibility, :organisationally_visible} #{_('Organisation: anyone at my organisation can view')}") %>
      </div>
      <div class="radio">
        <%= f.label :visibility_publicly_visible, raw("#{f.radio_button :visibility, :publicly_visible} #{_('Public: anyone can view')}") %>
      </div>
    </div>
    <div class="col-xs-8">
      <%= f.submit(_('Update'), style: 'display:none') %>
    </div>

Interestingly though, some older versions are still in the app.pot:

msgid "Private: restricted to me and my collaborators"
msgstr ""

msgid "Private: restricted to me and people I invite."
msgstr ""
briri commented 6 years ago

I believe this is related to: https://github.com/ruby-gettext/gettext/issues/42

Here is a screenshot of a Brazilian Portuguese translation that was just recently created: screen shot 2018-04-03 at 11 10 12 am

The app.po contains the following for the top visibility radio buttons:

msgid "Organisation: anyone at my organisation can view"
msgstr "Organização: qualquer pessoa em minha organização pode ver"

msgid "Organisation: anyone at my organisation can view."
msgstr "Organização: qualquer pessoa em minha organização pode ver."

...

msgid "Private: restricted to me and my collaborators"
msgstr "Privado: restrito a mim e a meus colaboradores"

msgid "Private: restricted to me and people I invite."
msgstr "Privado: restrito a mim e a meus convidados."

...

msgid "Public: anyone can view on the web"
msgstr "Público: qualquer usuário na web pode visualizar."

msgid "Public: anyone can view."
msgstr "Público: qualquer pessoa pode visualizar."

So it looks as though the app.pot file contains older versions of the messages (e.g. note the period '.' at the end of the Organisation ones in the yaml file. The screenshot shows that it was able to match the Organisation one and pull it in. The screenshot however shows the 'public' entry without a period but the yaml file does not have a version without the period. The 'Private' entry does not exist at all in the yaml.

I ran rake gettext:find today and those entries were still not found.

I think we may want to consider moving away from embedding translatable text in Ruby's interpolated strings as mentioned here: https://github.com/ruby-gettext/gettext/issues/42

so move toward:

<% private = _('Private: visible to me, specified collaborators and administrators at my organisation') %>
<%= f.label :visibility_privately_visible, raw("#{f.radio_button :visibility, :privately_visible} #{private}) %>

instead of:

<%= f.label :visibility_privately_visible, raw("#{f.radio_button :visibility, :privately_visible}\
        #{_('Private: visible to me, specified collaborators and administrators at my organisation')}") %>
briri commented 6 years ago

Thanks to @stephaniesimms for pulling together this list of strings that are being missed.

Emails There is code in place that forces the system to use the default language when creating email messages. We should switch this to use the recipient's preferred language (or the default if none is specified)

Notification messages Notification messages all partial and strange (some screenshots below) screen shot 2018-04-05 at 10 53 14 am screen shot 2018-04-05 at 10 59 26 am screen shot 2018-04-05 at 11 12 13 am

Checkboxes and Radio buttons We've been using string interpolation as a practice to create Bootstrapped checkboxes and radio buttons that still make use of Rails' ActionView form helpers to create these elements. We will need to adjust this by either using a '+' to combine the strings or set the label text as a variable this is happening for these elements across the entire site. Some examples: screen shot 2018-04-05 at 11 08 05 am screen shot 2018-04-05 at 11 19 55 am

Specific areas of text The following text is likely not properly marked up for Gettext:

'See the full list' link for guidance selection screen shot 2018-04-05 at 11 10 39 am

Autosave message temporal text 'just now' ... 'less than a minute ago' screen shot 2018-04-05 at 11 15 11 am

Some headers on static pages (Terms of Use & Privacy e.g.) screen shot 2018-04-05 at 11 27 50 am

Public plans description screen shot 2018-04-05 at 11 29 07 am

New columns added to Users table screen shot 2018-04-05 at 11 34 28 am

Headings for Edit user privileges modal screen shot 2018-04-05 at 11 35 16 am

Header and button text for editing user profile screen shot 2018-04-05 at 11 36 48 am

Header for 'Usage statistics' screen shot 2018-04-05 at 11 38 35 am

Missed link text for Templates page 'All' 'Published' etc... but yes for Customization tab links??? screen shot 2018-04-05 at 11 39 15 am screen shot 2018-04-05 at 11 40 07 am

'Add' and 'Edit' for buttons in template customization screen shot 2018-04-05 at 1 53 27 pm

briri commented 6 years ago

The timeago.js files are also not getting discovered by gettext. We also peg the language to en_GB but should instead add the current user's language of choice to the json object defined at the bottom of application.rb and so that its available in the constants.js file.

briri commented 6 years ago

also related to #166 which would pull the bootstrap, devise and contact_us strings into the app.pot

briri commented 6 years ago

found a case where the label_tag was using a symbol instead of translatable text in the 'views/users/_admin_grant_permissions.htmlerb' <%= label_tag :organisational_admin_privileges %> should be <%= label_tag _('Organisational admin privileges') %>

benjaminfaure commented 6 years ago

Hello, when migrating from roadmap 0.3 to 1.0 I had some issues with the French version. I had the following error :

I18n::MissingTranslationData - translation missing: fr.date.formats.default:
  i18n (0.9.5) lib/i18n.rb:326:in `handle_exception'
  i18n (0.9.5) lib/i18n.rb:172:in `translate'
  i18n (0.9.5) lib/i18n/backend/base.rb:81:in `localize'
  gettext_i18n_rails (1.8.0) lib/gettext_i18n_rails/backend.rb:30:in `method_missing'
  i18n (0.9.5) lib/i18n.rb:258:in `localize'

Unless I missed it, there is no task to update the abbreviation in the database from frto fr_FR. I had to update the row in the db. (In the seed file, the abbreviation is fr too).

Some YML file are still using "fr" as a prefix for the French language. Some files may not be used anymore :

stephaniesimms commented 6 years ago

can't test UI but will verify as i monitor changes to the portuguese translation in dmptool. closing issue.