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

Disambiguate "Dismiss" localizations #19028

Closed
mokagio opened this issue Jul 12, 2022 · 4 comments
Closed

Disambiguate "Dismiss" localizations #19028

mokagio opened this issue Jul 12, 2022 · 4 comments

Comments

@mokagio
Copy link
Contributor

mokagio commented Jul 12, 2022

Problem

While smoke testing version 20.2, sharp eyed @tiagomar noticed an issue. In the QR code login screen, the English copy for the message and button are "Tap dismiss and..." and "Dismiss" respectively, but the Italian translation was inconsistent:

image

This happened because there is no clear relationship between the "Dismiss" used in the message and the one used in the button, so it's up to the translator or translators that happened to pick up the string to use the translation they think makes more sense given the limited context provided by the developer comment.

To make matter worse, we have 20 usages of the "Dismiss" across the app:

/* Accessibility label for button to dismiss a bottom sheet
Accessibility label for the transparent space above the login dialog which acts as a button to dismiss the dialog.
Accessibility label for the transparent space above the signup dialog which acts as a button to dismiss the dialog.
Action shown in a bottom notice to dismiss it.
Action to show on alert when view asset fails.
Button label that dismisses the qr log in flow and returns the user back to the previous screen
Customize Insights button title
Dismiss a view. Verb
Dismiss button title
Dismiss button title.
Dismiss the AlertView
Share extension error dialog cancel button label.
Spoken accessibility label
The title of a button to close the classic editor deprecation notice alert dialog.
Title for button that will dismiss the Grow Your Audience card.
User action to dismiss featured media options.
User action to dismiss media options.
Verb. Button title. Tapping dismisses a prmopt.
Verb. Dismisses the blogging prompt notification.
Verb. User action to dismiss error alert when failing to load media item. */
"Dismiss" = "Dismiss";

While "Dismiss" might work in English in all those instances, we cannot assume whichever translation "Dismiss" happens to have in one locale is appropriate in all the instances for that locale as well. As a matter of fact, that is exactly the case for the Italian locale, where "Dismiss" got translated to "Respinto" ("Reject"), but then translated to "Ignora" ("Ignore") in the context of the "Tap dismiss and..." copy for the QR code screen.

Proposed Solution

We need to disambiguate between the various context in which "Dismiss" is used.

One option would be to use replace each NSLocalizedString("Dismiss", "...") definition with ones using reverse DNS notation for the key, e.g. NSLocalizedString("qr_code_login.verify_authorization.dismiss_button", "..."). This approach would result in dedicated entries for each "Dismiss" usage and should give translators more flexibility.

This approach (kudos @AliSoftware for making it happen) is already in use, for example in StatSection.swift:

return NSLocalizedString("stats.insights.mostPopularCard.title", value: "🔥 Most Popular Time", comment: "Insights 'Most Popular Time' header. Fire emoji should remain part of the string.")

If we had this setup in place at the time of the issue described above, we could have fixed the translation for the button and message in the QR code screen to be in line and consistent, that is with a better Italian translation that actually signifies dismiss, like "Dismetti". Instead, we had to edit the message translation to use "Respinto" because we couldn't risk changing the button translation as it was used in 19 other screens.

And alternative to ensure consistency, albeit without extra flexibility, would be to use string interpolation:

static let subtitle = NSLocalizedString(
  "Tap %@ and head back to your web browser to continue.", 
  comment: "Subtitle instructing the user to tap the dismiss button to leave the log in flow. %@ is a placeholder for the dismiss button name"
)
 
static let confirmButton = NSLocalizedString(
  "Dismiss",
  comment: "Button label that dismisses the qr log in flow and returns the user back to the previous screen"
)
@mokagio
Copy link
Contributor Author

mokagio commented Jul 12, 2022

I have a demo for the reverse-DNS approach: #19029

@AliSoftware
Copy link
Contributor

AliSoftware commented Jul 12, 2022

I think we should actually adopt a mix of both your suggestions, so that we have both the ability to provide a different translation of "Dismiss" for each of the 20 places based on context… and ensure consistency (between subtitle and button title on that screen) via code, instead on assuming the translator(s) will know the relation between those two strings.

static let subtitle = NSLocalizedString(
  "qr_code_login.verify_authorization.subtitle",
  value: "Tap %@ and head back to your web browser to continue.", 
  comment: "Subtitle instructing the user to tap the dismiss button to leave the log in flow. %@ is a placeholder for the dismiss button name"
)
 
static let confirmButton = NSLocalizedString(
  "qr_code_login.verify_authorization.dismiss_button",
  value: "Dismiss",
  comment: "Button label that dismisses the qr log in flow and returns the user back to the previous screen"
)

@mokagio
Copy link
Contributor Author

mokagio commented Jul 14, 2022

I think we should actually adopt a mix of both your suggestions...

@AliSoftware I've been thinking about this and I agree with you. Even though interpolation feels a bit clunky, the translators are familiar with it already and it's the most secure way to ensure consistency.

@mokagio mokagio modified the milestones: 20.4, 20.5 Jul 24, 2022
@mokagio mokagio modified the milestones: 20.5, 20.6 Aug 8, 2022
@mokagio mokagio modified the milestones: 20.6, 20.7 Aug 21, 2022
@mokagio mokagio modified the milestones: 20.7, 20.8 Sep 5, 2022
@mokagio mokagio modified the milestones: 20.8 ❄️, 20.9 Sep 19, 2022
@mokagio mokagio modified the milestones: 20.9, 21.0 Oct 2, 2022
@mokagio mokagio modified the milestones: 21.0, 21.1 Oct 16, 2022
@mokagio mokagio modified the milestones: 21.1, 21.2 Oct 31, 2022
@mokagio mokagio modified the milestones: 21.2, 21.3 Nov 11, 2022
@oguzkocer oguzkocer removed this from the 21.3 milestone Nov 28, 2022
@oguzkocer oguzkocer added this to the 21.4 milestone Nov 28, 2022
@spencertransier spencertransier modified the milestones: 21.4, 21.5 Dec 16, 2022
@mokagio
Copy link
Contributor Author

mokagio commented Jan 9, 2023

#19635 closed this issue, but I forgot to followup or to use one of GitHub's option to close this as it got merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants