Comments

a.dmitriiev created an issue. See original summary.

nerdstein’s picture

Status: Active » Needs review

Moving to needs review

dani3lr0se’s picture

Issue summary: View changes
StatusFileSize
new53.28 KB

Thanks for the patch. It applied successfully but it's still not translating for me. I added a new language, enabled configuration translation for password policy, but still see it in english instead of the language I added. See attached screenshot. Is there another step I should be taking?

imen ch’s picture

StatusFileSize
new3.21 KB
new68.13 KB

I have tested the patch and it solved the problem, but this patch do not solve the problem of labels ('at least', 'at most') witch are not translatable on PasswordLength plugin.

I created a new patch (based on translatable_character_types.patch) , to make labels ('at least', 'at most') translatable.

@daniel_rose : after applying the patch you should load Password Policy Constraints summary page: ( Configuration -> Security -> Password Policies -> Configure Constraints), and then on user interface translation, translate theses labels:
- Uppercase, Lowercase, Numeric, Special characters, at least, at most.

Status: Needs review » Needs work

The last submitted patch, 4: 2975694-Policy-constraints-summary-variables-not-translatable.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

imen ch’s picture

StatusFileSize
new3.24 KB

Improve the patch code to validate Drupal coding standard.

imen ch’s picture

New patch to validate Drupal coding standard

imen ch’s picture

New patch to validate Drupal coding standard

imen ch’s picture

New patch to validate Drupal coding standard

shortspoken’s picture

Works as expected. Thanks for the patch. :)

michael.acampora’s picture

Updated the patch, the password length check translations (at least, at most) are already implemented.

aohrvetpv’s picture

Status: Needs work » Needs review

Setting to "Needs review" so tests are run.

Status: Needs review » Needs work
natew’s picture

We ran into the same issues, I am attaching a patch that handles translations and formatting for plurals. We tried to use the same method as the status for the constraints. Also added back the "at most" and "at least".

natew’s picture

Status: Needs work » Needs review
aohrvetpv’s picture

Status: Needs review » Needs work

#14 doesn't apply.

sylus’s picture

Since the bottom half of patch was added just adding this here with it removed.

aohrvetpv’s picture

Status: Needs work » Needs review
ant1’s picture

#17 seems to fix the issue for me. Strings are being translated, as they should be. Thanks.

hoemmawelt’s picture

# 17 seems to fix the issue for me too. Now it is possible to translate the strings.

narres’s picture

Why not just to change

  public function getSummary() {
    return $this->t('Password must contain @characters @character-type characters', ['@character-type' => $this->configuration['character_type'], '@characters' => $this->configuration['character_count']]);
  }

to

  public function getSummary() {
    return $this->t('Password must contain @characters @character-type characters', ['@character-type' => t($this->configuration['character_type']), '@characters' => $this->configuration['character_count']]);
  }

?

narres’s picture

lamp5’s picture

Status: Needs review » Reviewed & tested by the community

Patch #17 works well, It fix also singular/plural form. @narres about your patch, it is not good approach to pass variables to the t() function, please check https://www.drupal.org/docs/8/api/translation-api/overview#s-variables-in-user-interface-text

paulocs’s picture

Patch #17 looks good!
I'm re-adding it because the last patch of the issue is the patch that should be committed.

nerdstein’s picture

Assigned: Unassigned » nerdstein
Status: Reviewed & tested by the community » Patch (to be ported)

Merging in #17 after my review - thanks all!

  • nerdstein committed 03ec42b on 8.x-3.x authored by paulocs
    Issue #2975694 by imen ch, a.dmitriiev, narres, natew, sylus, mike....
nerdstein’s picture

Status: Patch (to be ported) » Fixed

Marking as fixed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.