Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Extract strings using WebExtension i18n library #2344

Merged
merged 1 commit into from
Mar 11, 2017

Conversation

jaredhirsch
Copy link
Member

Fixes part of #2294. Doesn't yet manage the transformation from a pontoon .properties file to this messages.json format.

I haven't been super consistent about the l10n keys. If anyone has strong opinions here, I am open to suggestions (cc @flodolo).

Copy link
Collaborator

@flodolo flodolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add a comment to all strings because it would get messy, but I'd suggest a different approach in naming these strings.

If a string is going to be used as a title, let's use Title in the ID, that will spare us comments in the localization file.

Note that we'll still need to manually add some comments later, e.g. for "Download"

"loginErrorDetails": { "message": "Your shot was not saved. There was an error authenticating with the server." },
"loginConnectionErrorDetails": { "message": "There may be a problem with the service or your network connection." },
"unshootablePageError": { "message": "Page cannot be screenshotted." },
"unshootablePageErrorDetails": { "message": "This is not a normal web page, and Page Shot cannot capture screenshots from it." },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated copy question: "capture screenshots from it"? I would expect "of it" here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"capture screenshot from it" and "capture screenshot of it" read basically the same to me; I have no opinion.

"loginConnectionErrorDetails": { "message": "There may be a problem with the service or your network connection." },
"unshootablePageError": { "message": "Page cannot be screenshotted." },
"unshootablePageErrorDetails": { "message": "This is not a normal web page, and Page Shot cannot capture screenshots from it." },
"recursivePageShotShotError": { "message": "You can't take a shot of a Page Shot page!" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to use proper apostrophes instead of straight quotes.

You can’t take a shot of a Page Shot page!

For reference, such a string would fail tests on Firefox and be rejected.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"selectorCancel": { "message": "Cancel" },
"selectorDownload": { "message": "Download" },
"contextMenuText": { "message": "Create Page Shot" },
"notificationLinkCopied": { "message": "Link Copied" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use notificationLinkCopiedTitle to clarify the role of this string? That would spare us a localization comment in the .properties file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"unshootablePageErrorDetails": { "message": "This is not a normal web page, and Page Shot cannot capture screenshots from it." },
"recursivePageShotShotError": { "message": "You can't take a shot of a Page Shot page!" },
"genericError": { "message": "Page Shot went haywire." },
"genericErrorTryAgain": { "message": "Try again or take a shot on another page?" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genericErrorDetails

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

},
SHOT_PAGE: {
title: "You can't take a shot of a Page Shot page!"
title: browser.i18n.getMessage("recursivePageShotShotError")
Copy link
Collaborator

@flodolo flodolo Mar 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come SHOT_PAGE and MY_SHOTS don't have a info, and use a really long title instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flodolo Thanks very much for your feedback here. A lot of the error messages reuse the same strings, so I thought it would be best to avoid duplication, and it seemed awkward in the code for error message X to use a string named ERROR_Y. However, I wasn't thinking that the primary audience for the l10n keys is actually the localizers, not the engineers. I'll overhaul the names to reflect their usage in the app, rather than awkwardly summarize their English language content.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and to your question at this line - I'm not sure why some errors don't have a second component, probably just an arbitrary implementation choice

@jaredhirsch
Copy link
Member Author

@ianb Mind taking a look?

@ianb ianb self-requested a review March 10, 2017 22:44
Copy link
Contributor

@ianb ianb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. As mentioned before, when you are ready to generate messages.json you could do that similarly to how inlineSelectionCss.js is generated. Though for multiple files it'll be a little more complicated... but if you do that first part then I can do the multiple file stuff in the Makefile.

jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 10, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon.

- Add a pontoon-to-webextension build step to the Makefile

- Also, replace the hand made messages.json with the more nicely-formatted
  script output.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 11, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon.

- Add a pontoon-to-webextension build step to the Makefile

- Also, replace the hand made messages.json with the more nicely-formatted
  script output.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 11, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon.

- Add a pontoon-to-webextension build step to the Makefile

- Also, replace the hand made messages.json with the more nicely-formatted
  script output.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 11, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon.

- Add a pontoon-to-webextension build step to the Makefile

- Also, replace the hand made messages.json with the more nicely-formatted
  script output.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 11, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon.

- Add a pontoon-to-webextension build step to the Makefile

- Also, replace the hand made messages.json with the more nicely-formatted
  script output.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
@jaredhirsch jaredhirsch merged commit 67d336b into mozilla-services:master Mar 11, 2017
@jaredhirsch jaredhirsch deleted the extract-strings branch March 11, 2017 01:20
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 11, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon.

- Add a pontoon-to-webextension build step to the Makefile

- Also, replace the hand made messages.json with the more nicely-formatted
  script output.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 12, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon.

- Add a pontoon-to-webextension build step to the Makefile

- Also, replace the hand made messages.json with the more nicely-formatted
  script output.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 14, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon. Remove the webextension-formatted strings from git.

- Add a pontoon-to-webextension build step to the Makefile.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
jaredhirsch added a commit to jaredhirsch/screenshots that referenced this pull request Mar 14, 2017
- Add pontoon-to-webext.js script from bwinton/SnoozeTabs repo and
  related npm dependencies (to be removed when/if that script is
  published on npm as a standalone module).

- Add extracted strings to a properties file at the location expected by
  Pontoon. Remove the webextension-formatted strings from git.

- Add a pontoon-to-webextension build step to the Makefile.

This commit, together with the fix for mozilla-services#2344, closes mozilla-services#2294.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants