Conversation
25d1f7f to
270cdba
Compare
|
Update: I fixed some missing keys, I also removed the commit where I used Nokogiri to clean up the incoming XML, we got better results from our vendor. |
|
Also pushed another commit renaming an i18n key to be friendlier for future translation exports |
config/locales/devise/en.yml
Outdated
There was a problem hiding this comment.
It looks like this introduced a bunch of additional spaces before the end quote. I see several instances where this happened in this PR. Was that intentional?
There was a problem hiding this comment.
What was the reason for replacing the > convention with quoted strings?
There was a problem hiding this comment.
This is an artifact of i18n-tasks normalize and our use of the > when wrapping lines. The newlines were already there, this is just making them more explicit:
require 'yaml'
=> true
YAML.load <<-STR
key:
key: >
some string
that we wrap
other: thing
STR
=> {"key"=>{"key"=>"some string that we wrap\n", "other"=>"thing"}}I can make a pass and run String#strip on all our keys to remove these?
There was a problem hiding this comment.
i18n-tasks normalize uses YAML.dump which almost never wraps lines and just uses string quotes
There was a problem hiding this comment.
Is there a way for i18n-tasks normalize to ignore wrapping with >? Do we prefer > or string quotes? If string quotes, I would vote to strip them because it looks weird and messy. I like the cleanliness of > and being able to wrap at a comfortable reading line length.
There was a problem hiding this comment.
Ok so I have a compromise!
It turns out naive YAML.dump on my machine outputs wraps lines at around 100c by default, without quotes if it can.
I made a script that strips whitespace on YAML files in-place and dumps them back, which has the default line wrapping of 100c.
Then I added a lint spec that makes sure the files are formatted to match this, so hopefully this can help keep our files consistent moving forward?
a46700c to
c546098
Compare
config/locales/instructions/fr.yml
Outdated
There was a problem hiding this comment.
This needs a space after the colon because there is more text to the right of it that is dynamically displayed by the password strength JS.
config/locales/instructions/en.yml
Outdated
There was a problem hiding this comment.
This space after the colon was probably automatically stripped, but it's required in this case.
There was a problem hiding this comment.
Ok, I'll update the scripts to use chomp to remove newlines instead of all whitespace.
There was a problem hiding this comment.
PTAL at 0426f5e8e341e8bc84c11e84f8352b8d1462e13e
config/locales/instructions/es.yml
Outdated
There was a problem hiding this comment.
Same here with the missing space after the colon.
spec/i18n_spec.rb
Outdated
There was a problem hiding this comment.
The .new is causing the tests to fail because strip_each is a class method.
spec/lib/yaml_normalizer_spec.rb
Outdated
There was a problem hiding this comment.
s/#strip_each/.strip_each
# is for instance methods, . is for class methods
There was a problem hiding this comment.
Yeah this is a result of me flip-flopping on instance vs class, I'll fix it, thanks.
scripts/normalize-yaml
Outdated
There was a problem hiding this comment.
Should we include usage instructions in the README?
There was a problem hiding this comment.
Do you think that the note in the i18n_spec.rb spec description for failures that points to the script is close enough? I don't want the README to get too noisy
There was a problem hiding this comment.
If this script is meant to be run every time we receive new translations, I think it would be better to give it more visibility, whether in a Wiki or some other place where developers are likely to look up translation-related documentation. What do you think? At the very least, the example in the spec should mention that the command needs a path passed after it. Running scripts/normalize-yaml by itself doesn't do anything. Also, I'm assuming you can give the script a directory, and it will normalize all the files in the directory, but when I tried scripts/normalize-yaml config/locales, it gave me an error. How do you pass in a directory?
There was a problem hiding this comment.
This script needs to be run every time we touch translations files (such as when adding new keys to make sure they're alphabetized and wrapped consitently)
To run multiple files, I run:
git ls-files -- config/locales | xargs ./scripts/normalize-yaml
I'll update our translations page in the wiki with this
config/locales/idv/fr.yml
Outdated
There was a problem hiding this comment.
Looks like this introduced an extra single quote in n''aurez
config/locales/idv/fr.yml
Outdated
There was a problem hiding this comment.
Another extra unnecessary single quote here
|
Looks like your 4th commit introduced a trailing whitespace in many places that don't need it, as well as unnecessary extra single quotes in words that already have a quote in them. |
|
Re: "unnecessary" single quotes, they parse out to the correct thing, are you OK with leaving them in? YAML.load <<-STR
footnote: 'Vous n''aurez jamais à payer quoi que ce soit avec nous, ni à partager
le solde de vos comptes. Nous vérifions uniquement le numéro du compte pour
vérifier votre identité. '
STR
=> {"footnote"=>"Vous n'aurez jamais à payer quoi que ce soit avec nous, ni à partager le solde de vos comptes. Nous vérifions uniquement le numéro du compte pour vérifier votre identité. "} |
|
I personally think it looks weird. Can we revert that change and manually add the extra space in those 3 places that need it? |
|
@monfresh which change? There have been so many changes. Do you mean revert the normalization part, or just the |
92960cf to
aae7cd8
Compare
aae7cd8 to
a97bddd
Compare
**Why**: Better copy **How**: Also run i18n-tasks normalize to make things consistent
**Why**: When we ship translations off to vendors, "2fa" gets turned into the XML tag <2fa> which an invalid tag indentifier, so changing this makes for a friendlier translation pipeline.
**Why**: Makes sure we have consistent formatting, naive YAML.dump adds line wrapping around 100c Also, add special exception for ': ' when trimming whitespace
We've since moved away from vendor which received string content as XML Originally: #1531
* Reimplement password strength as ViewComponent, custom element changelog: Internal, Code Quality, Improve maintainability of password strength UI element * Use score directly in class and strength strings Avoid mappings See: #9826 (comment) * Remove XML-safe check from i18n_spec We've since moved away from vendor which received string content as XML Originally: #1531 * Update specs for PasswordConfirmationComponent * Add specs for PasswordStrengthElement * Arrange conditions in consistent order Easier comparison See: https://github.com/18F/identity-idp/pull/9826/files#r1443220055 Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com> * Add PasswordStrengthComponent specs * Add PasswordStrengthComponent component preview * Update PasswordToggleComponent to respect custom field ID * Add test coverage for event disavowal password change JavaScript --------- Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
A few notes:
our vendor is giving us poorly formed XML so I patched the converter script to accept this
to try to keep things consitent, I ran
i18n-tasks normalizeafter importing strings, which created a lot of noise in ouren.ymlandfr.ymlfiles --- sorry for the diff noise but hopefully this should minimize noise in future PRs