Problem/Motivation

I spent two hours figuring out how to update translation strings for contributed modules. I followed these steps:

  • Enabled Interface Translation module
  • Went to admin/config/regional/translate
  • Searched for the strings I wanted to translate using the filter -- no luck
  • Paged through the list of strings -- no luck
  • Found that the list of strings changed in length depending of when Interface Translation module -- a rabbit trail
  • Google search on "drupal 8 t() string translation" -- lots of information but none pointing to admin/reports/translations
  • Read https://www.drupal.org/docs/8/api/translation-api/overview a few times -- no luck
  • Found a footnote about the only strings available in admin/config/regional/translate are core
  • Found admin/reports/translations -- finally!

I know this is sad -- especially to those working with these functions daily -- but it is true.

Proposed resolution

Add a note to the top of admin/config/regional/translate. Something like: String translation for contributed modules can be found at admin/reports/translations. This small change will help the next person using this function for the first time.

Remaining tasks

Get it committed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Greg Sims created an issue. See original summary.

cilefen’s picture

Version: 8.2.6 » 8.4.x-dev
Category: Bug report » Task

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Sutharsan’s picture

Issue tags: +Novice
chishah92’s picture

Assigned: Unassigned » chishah92
Status: Active » Needs work
chishah92’s picture

Status: Needs work » Needs review
FileSize
1.55 KB

Added the note in a patch.

ronaldtebrake’s picture

Status: Needs review » Needs work

Hi chishah92,

Thanks for taking this on, this still needs some work.
It's not the best idea in using the link as-is in the text. Because it does not allow you to change it in a later release without requiring translators to fix their work as well. Even for possibly static links, there might be changes, so it is best to remove the target from the URL.
You should however keep the link markup in the text, so that translators are aware of what is happening, and the link text is also there to translate in the sentence flow. This lets them move the link around, if the language at hand requires it, move out text from the link or vice versa.

See for example line 164 of locale.module:

return '<p>' . t('Interface translations are automatically imported when a language is added, or when new modules or themes are enabled. The report <a href=":update">Available translation updates</a> shows the status. Interface text can be customized in the <a href=":translate">user interface translation</a> page.', [':update' => \Drupal::url('locale.translate_status'), ':translate' => \Drupal::url('locale.translate_page')]) . '</p>';

You should be able to use the same idea, use a placeholder like :update, and make sure you let Drupal know render instead of the placeholder [':update' => \Drupal::url('locale.translate_status')]

For more background information please check:
https://www.drupal.org/docs/7/api/localization-api/dynamic-or-static-lin...

jeetendrakumar’s picture

Assigned: chishah92 » jeetendrakumar
jeetendrakumar’s picture

Status: Needs work » Needs review
FileSize
1.58 KB

Did changes as per suggestion in #7.

jeetendrakumar’s picture

Assigned: jeetendrakumar » Unassigned
ronaldtebrake’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.61 KB

Thanks, just updated the patch with a little nitpick. There was a redundant space in the anchor.

ronaldtebrake’s picture

Status: Reviewed & tested by the community » Needs review

Woopsie, was a little too fast too furious on that one. Back to needs review :).

chishah92’s picture

Assigned: Unassigned » chishah92
Status: Needs review » Needs work
chishah92’s picture

Status: Needs work » Needs review
FileSize
2.28 KB

Have fixed the redundant space issue.

Sutharsan’s picture

Status: Needs review » Needs work
+++ b/core/modules/locale/locale.module
@@ -169,7 +169,8 @@ function locale_help($route_name, RouteMatchInterface $route_match) {
+      $output .= '<p>' . t('String translation for contributed modules can be found at <a href=":translation-updates">available translation updates</a>.', [':translation-updates' => \Drupal::url('locale.translate_status')]) . '</p>';

This string does not explain what I can expect on the page it links to. "String translation" does not contain useful info. Considering the context of the page this message is on, I would mention the ability to mass import translations of contributed modules.

snehi’s picture

Status: Needs work » Needs review
FileSize
1.86 KB
2.3 KB

Tried as per comment.

Sutharsan’s picture

  1. +++ b/core/modules/locale/locale.module
    @@ -169,7 +169,8 @@ function locale_help($route_name, RouteMatchInterface $route_match) {
    +      $output .= '<p>' . t('This page allows translators to manually import translated strings contained in a Gettext Portable Object (.po) file. Manual import may be used for customized translations or for the translation of custom modules and themes. To customize translations you can download a translation file from the<a href=":url"> Drupal translation server </a> or <a title="User interface translation export" href=":export"> export</a> translations from the site, customize the translations using a Gettext translation editor, and import the result using this page.', [':url' => 'https://localize.drupal.org', ':export' => \Drupal::url('locale.translate_export')]) . '</p>';
    

    This line should not change in this issue. This issue is about adding extra help text. Extending the scope of an issue will slow the issue down. If it is a mistake, remove the change. If it is intentionally, remove the change and create a new issue.

  2. +++ b/core/modules/locale/locale.module
    @@ -169,7 +169,8 @@ function locale_help($route_name, RouteMatchInterface $route_match) {
    +      $output .= '<p>' . t('Translations ready for bulk import for contributed modules can be found at <a href=":translation-updates">available translation updates</a>.', [':translation-updates' => \Drupal::url('locale.translate_status')]) . '</p>';
    

    I don't think that 'bulk' or 'mass' is relevant in this context. When I read the help text, it describes this page is for importing custom translations. The new sentence can connect to that message with the following:
    "Standard translations for contributed modules can be imported at ..."

    Page titles should start with a capital: "Available translation updates"

Sutharsan’s picture

Status: Needs review » Needs work
Sutharsan’s picture

  1. +++ b/core/modules/locale/locale.module
    @@ -169,7 +169,8 @@ function locale_help($route_name, RouteMatchInterface $route_match) {
    +      $output .= '<p>' . t('Translations ready for bulk import for contributed modules can be found at <a href=":translation-updates">available translation updates</a>.', [':translation-updates' => \Drupal::url('locale.translate_status')]) . '</p>';
           $output .= '<p>' . t('Note that importing large .po files may take several minutes.') . '</p>';
           return $output;
    

    I

  2. +++ b/core/modules/locale/locale.module
    @@ -169,7 +169,8 @@ function locale_help($route_name, RouteMatchInterface $route_match) {
    +      $output .= '<p>' . t('Translations ready for bulk import for contributed modules can be found at <a href=":translation-updates">available translation updates</a>.', [':translation-updates' => \Drupal::url('locale.translate_status')]) . '</p>';
           $output .= '<p>' . t('Note that importing large .po files may take several minutes.') . '</p>';
    

    It is not logical to add the new line at this position. The last sentence has not relation with the newly added. The new line should be placed last.

mohit1604’s picture

Status: Needs work » Needs review

I am working on this !

mohit1604’s picture

Thanks Sutharsan ! Did changes as per comment #17

Sutharsan’s picture

Note that you have added the extra string to a different page than the previous patches. On the positive side, you _have_ added it to the page mentioned in the issue summary. But now the text may no longer match the context. Lets rethink this ...

Sutharsan’s picture

Status: Needs review » Needs work

I agree with the first committers that the Import page is a better place for the link, as importing is a more intuitive place. And further these is also a reference to the automatic import functionality there. I propose to append it to the existing string as:

Translation files are automatically downloaded and imported when languages are added, or when modules or themes are enabled. Once enabled, you can manually check and update the translations.

Let's agree on the location and string first, before we make more patches.

ifrik’s picture

Good idea to agree on the wording first.
You can leave out the "once enabled" because you already say that the translations are downloaded as part of the enabling. And you might just as well mention that the import can also happen automatically.

The Interface translation settings page (admin/config/regional/translate/settings) already has a wording for this.

Select how frequently you want to check for new interface translations for your currently installed modules and themes. Check updates now.

Combining that with the proposed wording in #23, would be

Interface translations are automatically downloaded and imported when languages are added, or when new modules or themes are enabled. You can configure the frequency and behavior of automatic updates on the Interface translation settings page, or check manually on the Available translation updates page."

Sutharsan’s picture

@ifrik, super! I agree with your proposed text.

kiruba karan’s picture

Status: Needs work » Needs review
FileSize
2.04 KB

@Sutharsan

I created the patch based on the proposed text given by @ifrik. Please check.

Sutharsan’s picture

Assigned: chishah92 » Unassigned
Status: Needs review » Reviewed & tested by the community

The text is as agreed. Patch is clean.

Sutharsan’s picture

Both the summary and titel neefs to be updated, they are both out of date. Using the issue summary template is preferred. Updating will help the core maintainer to get the right information right away.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/locale/locale.module
@@ -168,7 +168,7 @@ function locale_help($route_name, RouteMatchInterface $route_match) {
-      $output = '<p>' . t('Translation files are automatically downloaded and imported when <a title="Languages" href=":language">languages</a> are added, or when modules or themes are enabled.', [':language' => \Drupal::url('entity.configurable_language.collection')]) . '</p>';
+      $output = '<p>' . t('Interface translations are automatically downloaded and imported when <a title="Languages" href=":language">languages</a> are added, or when new modules or themes are enabled. You can configure the frequency and behavior of automatic updates on the <a href=":locale-settings">Interface translation settings</a> page, or check manually on the <a href=":translation-updates">Available translation updates</a> page.', [':language' => \Drupal::url('entity.configurable_language.collection'), ':locale-settings' => \Drupal::url('locale.settings'), ':translation-updates' => \Drupal::url('locale.translate_status')]) . '</p>';

Can we get this array split onto multiple lines as per coding standards for arrays

also, still needs issue summary update.

thanks

shubhangi1995’s picture

Assigned: Unassigned » shubhangi1995
mohit1604’s picture

Assigned: shubhangi1995 » Unassigned
Status: Needs work » Needs review
FileSize
2.07 KB

Made changes as per #30, please review it. Thank you :)

zymbian’s picture

Status: Needs review » Reviewed & tested by the community

Patch #32 looks good. Marking RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 32: 2849929-32-D8.patch, failed testing. View results

zymbian’s picture

Status: Needs work » Reviewed & tested by the community
Sutharsan’s picture

Status: Reviewed & tested by the community » Needs work

Issue summary still needs update. See #28

mohit1604’s picture

Title: Add note to admin/config/regional/translate pointing to admin/reports/translations » Add a note on how to update translation strings for contributed modules
Issue summary: View changes
Issue tags: -Needs issue summary update

Updated issues summary and title.

mohit1604’s picture

Status: Needs work » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Needs review

Reading the final text and the issue summary seems that the original problem faced by the user is bot being addressed. From the issue summary.

I spent two hours figuring out how to update translation strings for contributed modules.

The new text makes no mention of where and how to update the translated strings.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Abhijith S’s picture

Patch #32 can't be applied on 9.2.x.Needs reroll.

Checking patch core/modules/locale/locale.module...
error: while searching for:
      return $output;

    case 'locale.translate_import':
      $output = '<p>' . t('Translation files are automatically downloaded and imported when <a title="Languages" href=":language">languages</a> are added, or when modules or themes are enabled.', [':language' => \Drupal::url('entity.configurable_language.collection')]) . '</p>';
      $output .= '<p>' . t('This page allows translators to manually import translated strings contained in a Gettext Portable Object (.po) file. Manual import may be used for customized translations or for the translation of custom modules and themes. To customize translations you can download a translation file from the <a href=":url">Drupal translation server</a> or <a title="User interface translation export" href=":export">export</a> translations from the site, customize the translations using a Gettext translation editor, and import the result using this page.', [':url' => 'https://localize.drupal.org', ':export' => \Drupal::url('locale.translate_export')]) . '</p>';
      $output .= '<p>' . t('Note that importing large .po files may take several minutes.') . '</p>';
      return $output;

error: patch failed: core/modules/locale/locale.module:168
error: core/modules/locale/locale.module: patch does not apply
Abhijith S’s picture

Rerolled patch #32 for 9.2.x.Please check.

kleiton_rodrigues’s picture

Assigned: Unassigned » kleiton_rodrigues

I m work on Issue #2849929

kleiton_rodrigues’s picture

Assigned: kleiton_rodrigues » Unassigned
Status: Needs review » Reviewed & tested by the community
FileSize
532.94 KB
383.71 KB

Looks good!
+1 RTBC

alexpott’s picture

Updating issue credit.

I was wrong in #39 the new text says

or check manually on the <a href=":translation-updates">Available translation updates</a> page

and links to admin/reports/translations

alexpott’s picture

@kleiton_rodrigues thank you for looking into this issue

Posting screenshots of your codebase or CLI does not advance the issue, since the automated testing infrastructure tells us whether the patch applies correctly.

Posting a screenshot of the new help text appearing is useful so I've decided to keep the credit box ticked but in future it'd be great to see an rtbc comment with more information. For example, detailing whether you've tested all the links and whether the fix actually fixes the problem outlined in the issue summary. For example, in #39 I reported that the fix didn't actually address the problem faced by the reporter, I was wrong, but it would have been good if the rtbc comment could have addressed this. See for information about how credit is awarded.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 46: 2849929-46.patch, failed testing. View results

renatog’s picture

In this case below, "language" is the URL that's right?!

So please could you update the token name to ':language-url'?

Is better to be clear in the code due only "language" is generic.

E.g.:

From:
':language' => Url::fromRoute('entity.configurable_language.collection')->toString(),

To:
':language-url' => Url::fromRoute('entity.configurable_language.collection')->toString(),

And from:
<a title="Languages" href=":language">languages</a>

To:
<a title="Languages" href=":language-url">languages</a>

ayushmishra206’s picture

Status: Needs work » Needs review
FileSize
1.59 KB
2.15 KB

Made the suggested change in #52. Please review.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

priyanka.sahni’s picture

Assigned: Unassigned » priyanka.sahni

Verified and tested by applying the patch #53 on Drupal 9.2.x. Patch was successfully applied.

Steps to Replicate -
1. Go to the codebase.
2. Go to modules -> locale.
3. Go to locale.module -> search for case 'locale.translate_import': .
4. Verify the text updated.

Before Patch -
BeforePatch
BeforePatch

After Patch -
AfterPatch
AfterPatch

priyanka.sahni’s picture

Assigned: priyanka.sahni » Unassigned
priyanka.sahni’s picture

FileSize
988.28 KB
418.67 KB
priyanka.sahni’s picture

FileSize
444.21 KB
822.52 KB

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Rinku Jacob 13’s picture

Re-rolled patch #53 for 9.5.x.

VinmayiSwamy’s picture

Verified re-rolled patch #61 for 9.5.x. Failed to apply.

DishaKatariya’s picture

Assigned: Unassigned » DishaKatariya
DishaKatariya’s picture

Assigned: DishaKatariya » Unassigned
Status: Needs review » Reviewed & tested by the community
FileSize
122.71 KB
196.31 KB
135.4 KB
188.49 KB
36.62 KB

Verified and tested #61 Patch applied successfully on Drupal 9.5.x-dev and looks good to me.

Testing Steps:
1. Go to the codebase.
2. Go to modules -> locale.
3. Go to locale.module -> search for case 'locale.translate_import': .
4. Verify the text updated.

Testing Results-
The Interface translation settings page (http://localhost/drupal-9.5.x/admin/config/regional/translate/import) the text is updated

Please refer attached screenshots.
Can be a move to RTBC.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs subsystem maintainer review

Thanks @priyanka.sahni and @DishaKatariya for your manual testing. Note that it is never necessary or appropriate to attach screenshots of the code in your IDE, nor of your terminal window. This was also explained in #50. Please read the previous comments on the issue before posting your own.

I also recommend reviewing the contributor task instructions for creating a screenshot, particularly the following points.

  • Only include the parts of the page that are relevant.
  • Make the browser window narrow, and/or crop the image to under 600px wide, so that when it is embedded in a comment in an issue, it displays clearly without being resized.
  • Make sure the image includes the URL of the page you took the screenshot of, or note it in a comment.
  • Annotate the image with arrows, boxes around parts to highlight, or words to help make the point of the image clearer.

Since the screenshots provided do illustrate the string change, I will grant issue credit for them, but please make cropped screenshots in small browser windows in the future to focus on the part of the UI with the change.

I don't think this string should say "automatic updates". That's an upcoming module that will automatically update the core codebase. It's also getting to be a lot of words, so we should focus on removing unnecessary words from the text so that there's not a UX regression. I would suggest:

Interface translations are automatically imported when languages are added, or when new modules or themes are enabled. You can configure these automatic imports on the Interface translation settings page, or check for translation updates manually.

We should probably also reduce the text in the following paragraphs to reduce the risk that people will skip over it because it's a wall of text. There's nearly an entire sentence we can eliminate, and we can also make it easier to scan with an ordered list:

This page allows translators to manually import translated strings for customized translations or custom modules and themes with a Gettext Portable Object (.po) file. To customize translations:

  1. Download a translation file from the Drupal translation server or export translations from the site.
  2. Customize the translations using a Gettext translation editor.
  3. Import the result using this page.

And then in the last paragraph there's not much we can improve, but we can at least get rid of the words "note that":

Importing large .po files may take several minutes.

I apologize if this feels like scope creep, but the overall amount of text on a page impacts usability, so reducing the overall text is one way to help this through the usability gate.

And please, crop your screenshots and ONLY post screenshots of the Drupal site user interface.

Thanks!

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.