Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple strings are re-used in different contexts (don't DRY with the translatable content) #16185

Open
brawaru opened this issue May 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@brawaru
Copy link
Contributor

brawaru commented May 8, 2021

Multiple strings from recent updates are re-used in different contexts. Despite their source translations match, this might lead to inconsistent and incorrect translations. The strings that are re-used:

Expected behaviour

Strings only should be used within their own context, DRY (Don't Repeat Yourself) approach does not work with translatable content, instead AHA (Avoid Hasty Abstractions) approach must be used that will reduce chances for this mistake by always introducing a new string in different contexts, even if there is a similar one in other context.

The strings in question are supposed to be used only within their appropriate contexts:

  • admin.accounts.moderation.active within ‘Accounts’ moderation view.
  • notifications.column_settings.filter_bar.show for filter bar toggle in notifications settings

Actual behaviour

The string were re-used within the different contexts:

admin.accounts.moderation.active

It is re-used within ‘following recommendations’ settings:

https://github.com/tootsuite/mastodon/blob/480d7c9478a9be3ac668b21402a269db41b10b18/app/views/admin/follow_recommendations/show.html.haml#L21

This causes problems with Russian locale for example, as the string is adapted and declined by the original context.

notifications.column_settings.filter_bar.show

It is re-used for ‘unread markers’ toggle within notification settings:

https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/app/javascript/mastodon/features/notifications/components/column_settings.js#L29

Steps to reproduce the problem

× not applicable.

Specifications

admin.accounts.moderation.active

Mistake introduced in commit f711764:

f711764#diff-92856dac4fae26e0f12a0c14c364928d16d4b0ec9b835d413110ebe79556b1aeR22

notifications.column_settings.filter_bar.show

Mistake introduced in commit 55ac2b9:

55ac2b9#diff-0b4b4ff412a8d0db0b4625619d3633b2cc295c4e7f21316e7941bb4728446d50R64

× os/browser not applicable.

@brawaru brawaru added the bug Something isn't working label May 8, 2021
@brawaru brawaru changed the title String re-used in different contexts: admin.accounts.moderation.active Multiple strings are re-used in different contexts (don't DRY with the translatable content) May 12, 2021
@brawaru
Copy link
Contributor Author

brawaru commented May 12, 2021

The issue has been updated to include one more re-used string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant