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

make strings localizable #888

Merged
merged 15 commits into from
Mar 17, 2021
Merged

make strings localizable #888

merged 15 commits into from
Mar 17, 2021

Conversation

JessicaBarh
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented Mar 2, 2021

Binder 👈 Launch a binder notebook on branch JessicaBarh/jupyterlab-git/add-i18n

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks for starting this @JessicaBarh

I left a few comment.

To quickly correct linter errors, you can run locally jlpm run eslint. And to check it jlpm run eslint:check.

src/components/BranchMenu.tsx Outdated Show resolved Hide resolved
src/components/Alert.tsx Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/widgets/GitWidget.tsx Outdated Show resolved Hide resolved
src/widgets/StatusWidget.ts Outdated Show resolved Hide resolved
@JessicaBarh
Copy link
Contributor Author

Thanks for your comments @fcollonval. I'm not to familiar with the test files so please let me know what I can modify if needed.

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Awesome work @JessicaBarh Thanks a lot for it.

Regarding the tests, we can directly use the nullTranslator - as we are not testing the translator. I made suggestions in that sense.

@goanpeca I would appreciate a review from you on this one.

tests/commands.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/BranchMenu.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/CommitBox.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/FileItem.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/FileItem.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/Toolbar.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/Toolbar.spec.tsx Outdated Show resolved Hide resolved
tests/commands.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/BranchMenu.spec.tsx Outdated Show resolved Hide resolved
tests/test-components/CommitBox.spec.tsx Outdated Show resolved Hide resolved
@goanpeca
Copy link
Member

Looking into it now. Thanks a lot @JessicaBarh !

src/components/Alert.tsx Outdated Show resolved Hide resolved
src/components/Alert.tsx Outdated Show resolved Hide resolved
src/commandsAndMenu.tsx Outdated Show resolved Hide resolved
src/commandsAndMenu.tsx Outdated Show resolved Hide resolved
src/commandsAndMenu.tsx Outdated Show resolved Hide resolved
src/commandsAndMenu.tsx Outdated Show resolved Hide resolved
src/commandsAndMenu.tsx Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
Copy link
Member

@goanpeca goanpeca left a comment

Choose a reason for hiding this comment

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

Hi @JessicaBarh. Great work. there are some things that need to change like `-> ' and some places where it is better to combine into a full string as some languages might have different opinions on the ordering of sentences.

Finally translation will not work on variables so we need to either apply trans to actual strings or handle that wherever those strings are generated.

Thanks a lot for working on this!

@JessicaBarh
Copy link
Contributor Author

Thanks for pointing these things out @goanpeca!
So if I had the case where:

plural = number_of_files > 1 ? 's' : ''
label: 'Show file${plural}'

What would be the best approach here to make label localizable?

@JessicaBarh JessicaBarh marked this pull request as draft March 15, 2021 20:53
@JessicaBarh JessicaBarh marked this pull request as ready for review March 16, 2021 15:51
@JessicaBarh JessicaBarh requested a review from fcollonval March 16, 2021 15:51
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR @JessicaBarh

@goanpeca thank you too to take the time for reviewing the PR

@fcollonval fcollonval merged commit f86d0b3 into jupyterlab:master Mar 17, 2021
@goanpeca
Copy link
Member

Hi @JessicaBarh

this is merged now, but to answer your question:

plural = number_of_files > 1 ? 's' : ''
label: 'Show file${plural}'

What would be the best approach here to make label localizable?

label: trans._n('Show file', 'Show files', number_of_files)

Thanks!

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

Successfully merging this pull request may close these issues.

Make this extension localizable and test translation infrastructure for extensions
3 participants