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

Provide all translation related functions #542

Merged
merged 2 commits into from
Jan 5, 2023

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jan 3, 2023

This moves all translation related functions from nextcloud server (OC.L10N) into this library, this allows apps using this library to run tests without mocking those functions.
We the could use this library within server instead.

* Provide both functions, code is mostly taken from server
  some minor cleanup
* Added test cases
* Added *not* exported `registry` module for loading
  translations (so this is not exposed to users)

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
lib/translation.ts Outdated Show resolved Hide resolved
lib/translation.ts Outdated Show resolved Hide resolved
lib/translation.ts Outdated Show resolved Hide resolved
lib/registry.ts Outdated Show resolved Hide resolved
lib/registry.ts Outdated Show resolved Hide resolved
lib/registry.ts Outdated Show resolved Hide resolved
lib/registry.ts Outdated Show resolved Hide resolved
lib/registry.ts Outdated Show resolved Hide resolved
lib/date.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

See comments!
Thank you so much for tackling this @susnux !!!!!!

@susnux
Copy link
Contributor Author

susnux commented Jan 5, 2023

See comments! Thank you so much for tackling this @susnux !!!!!!

😊

About tabs instead of spaces: All current souces in this library use spaces (see unchanged gettext.ts.
I can convert all sources to use tabs if you like?

@skjnldsv
Copy link
Contributor

skjnldsv commented Jan 5, 2023

About tabs instead of spaces: All current souces in this library use spaces (see unchanged gettext.ts.
I can convert all sources to use tabs if you like?

I have no preferences, as long as we're consistent.
We use tabs in most places at Nextcloud, but liek you said, this lib seems to be using spaces. So you can pick whichever you want, all tabs or all spaces 😉

@susnux susnux force-pushed the enh/provide-translation-func branch 2 times, most recently from eea174b to 449ce12 Compare January 5, 2023 12:32
@susnux
Copy link
Contributor Author

susnux commented Jan 5, 2023

@skjnldsv I now unified the indention style in all changed files, but I would prefer to change all other files after this PR is merged to keep the changes small / clear.

I think I resolved all comments, except the loadTranslations part, see comment above.

@susnux susnux force-pushed the enh/provide-translation-func branch from 449ce12 to 291c4f1 Compare January 5, 2023 13:11
* This provides all functions previously available within
  the `OC.L10N` namespace
* Including translation regestry functions and translation bundle
  loading
* Restructured the source files for better comprehensibility

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
@susnux susnux force-pushed the enh/provide-translation-func branch from 291c4f1 to 6d66daf Compare January 5, 2023 13:41
@skjnldsv skjnldsv merged commit 2f69bdc into master Jan 5, 2023
@delete-merged-branch delete-merged-branch bot deleted the enh/provide-translation-func branch January 5, 2023 14:51
This was referenced Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move OC.L10N.translate to this library
2 participants