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
Translation key migration #367
Translation key migration #367
Conversation
Just to make it clear, this commit is only about switching from arbitrary keys to using back the English strings as keys, right ? Next to that, we want a script that will generate (and keep up to date) the various i18n json files, and this script should be commited and integrated to the i18n workflow, correct @LouisDelbosc ? |
The current PR is about migration from one translation key standard to a new one, one where we can extract translation automatically. I don't know what strategy for automation translation we adopt, however it'll be easily automate-able (❓) |
9bb7021
to
995b9f0
Compare
Hmm test are breaking because I have an issue with i18next. Otherwise I'll look at it next Tuesday. |
The |
I have a fix for this, just waiting for tests and will push a PR. |
This PR hopefully should address the issue you are facing. |
@LouisDelbosc the fix has been merged, it should now be possible to use natural keys with |
995b9f0
to
bf26e66
Compare
Thank you @berhalak. Do you have an idea where the should I put the script to generate the translations keys ? Do you have a folder where you put this kind of code ? |
Yes, most scripts are in |
What is a plan for the French translation file? |
We'll do it later. Tomorrow I'll put the script in |
We'll finish the translations in another PR yes, but we'll need the French json keys to be updated accordingly, is that in your radar ? |
static/locales/en.client.json
Outdated
"Clear cell": "Clear cell", | ||
"Clear values": "Clear values", | ||
"Copy anchor link": "Copy anchor link", | ||
"Delete {{count}} columns_one": "Delete {{count}} columns", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is off with the script, every resource that needs pluralization is wrong. For example here, for one column it should say "Delete column".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I stated in the issue #336, we cannot automatically determine what would be the plural or singular form only by looking at the keys/texte.
You might ask "why bother with plurals and singular" ? Depending on the language, we could have multiples plurals variables, for one, for two maybe for three, some language may have edge case.
Since we cannot determine the value from the key, we decide to put in key the plural form and correct by hands the value for singular or other case.
I'll do the correction by hands on the singular keys which are off
Given we are using our own helper ( I'm thinking about something like this:
|
It would be possible but since there is multiples plural_form possible, the interface should be more like: makeT("my singular text",
{
count,
two: "my plural for {{count}}",
three: "my {{count}} form",
other: "{{count}} form",
}) with |
What about just supporting |
a966e1e
to
eacb3f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a couple of keys that are still using old schema. Regarding the build error, you can rebase on main branch, it should be fixed there.
"Trash is empty.": "Trash is empty.", | ||
"Unpin Document": "Unpin Document", | ||
"Workspace not found": "Workspace not found", | ||
"You are on the {{siteName}} site. You also have access to the following sites:": "You are on the {{siteName}} site. You also have access to the following sites:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those two should be merged (version for the personal site and for the team site).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, so the condition is wrong. Those two should be swapped.
"FullCopies": "Permission to access the document in full when needed", | ||
"AttributeNamePlaceholder": "Attribute name", | ||
"Everyone": "Everyone", | ||
"EveryoneElse": "Everyone Else", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This key is still used in ACL page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not really removed either. Here the new AccessRules
translations keys:
"AccessRules": {
"Add Column Rule": "Add Column Rule",
"Add Default Rule": "Add Default Rule",
"Add Table Rules": "Add Table Rules",
"Add User Attributes": "Add User Attributes",
"Allow everyone to copy the entire document, or view it in full in fiddle mode.\nUseful for examples and templates, but not for sensitive data.": "Allow everyone to copy the entire document, or view it in full in fiddle mode.\nUseful for examples and templates, but not for sensitive data.",
"Allow everyone to view Access Rules.": "Allow everyone to view Access Rules.",
"Attribute name": "Attribute name",
"Attribute to Look Up": "Attribute to Look Up",
"Checking...": "Checking...",
"Condition": "Condition",
"Default Rules": "Default Rules",
"Delete Table Rules": "Delete Table Rules",
"Enter Condition": "Enter Condition",
"Everyone": "Everyone",
"Everyone Else": "Everyone Else",
"Invalid": "Invalid",
"Lookup Column": "Lookup Column",
"Lookup Table": "Lookup Table",
"Permission to access the document in full when needed": "Permission to access the document in full when needed",
"Permission to view Access Rules": "Permission to view Access Rules",
"Permissions": "Permissions",
"Remove column {{- colId }} from {{- tableId }} rules": "Remove column {{- colId }} from {{- tableId }} rules",
"Remove {{- tableId }} rules": "Remove {{- tableId }} rules",
"Remove {{- name }} user attribute": "Remove {{- name }} user attribute",
"Reset": "Reset",
"Rules for table ": "Rules for table ",
"Save": "Save",
"Saved": "Saved",
"Special Rules": "Special Rules",
"Type a message...": "Type a message...",
"User Attributes": "User Attributes",
"Users": "Users"
},
I count 32 keys for both the new AccessRules
and the old translations keys.
"UpdatingRecordLayout":"Updating record layout." | ||
}, | ||
"RecordLayoutEditor": { | ||
"AddField":"Add Field", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those keys as still used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not really removed. I removed the folder key (in this case components
) to have a flatter file. The new RecordLayoutEditor translations look like this :
"RecordLayoutEditor": {
"Add Field": "Add Field",
"Create New Field": "Create New Field",
"Show field {{- label}}": "Show field {{- label}}",
"Save Layout": "Save Layout",
"Cancel": "Cancel"
}
Of course the file has been updated and there the key named AddField
is replaced by Add Field
eacb3f9
to
f4f0238
Compare
@berhalak I don't have the errors there is on the CI locally. Was I just lucky ? |
I'm restarting the last build, can't reproduce the error locally. |
f4f0238
to
f8fb848
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @LouisDelbosc, it looks great. I will merge this PR after those conflicts are resolved. Sorry for the delay, but this is a big PR, and we need to synchronize it with the release schedule.
Just to be clear, is the next step for this PR for @LouisDelbosc to resolve the merge conflicts? Someone recently volunteered to do a Portuguese translation and is already testing a weblate project https://hosted.weblate.org/projects/grist/client/. I don't want to slow them down, so I'm willing to fix up anything that needs fixing to adapt any work they do. It would be better to get this PR through sooner rather than later though, both for this reason and because it touches a lot of files (so merge conflicts will continue to accumulate). That said it is a holiday period, Happy New Year everyone, looking forward to 2023 bringing a very multilingual Grist :-) |
@paulfitz hey :)
I'd say so! @LouisDelbosc is indeed in holiday ;) |
f8fb848
to
1a4299b
Compare
Thanks @LouisDelbosc ! |
1a4299b
to
67c09d7
Compare
There was new conflicts I fixed. I'd like this PR to be merged so I don't have to fix conflict as a job 😅 |
Related issue #336
I did not add the script I used. If you wish for me to commit it, please tell me where should I put it.