feat(extract-translations): add extract translations script
#597
Open
bertyhell wants to merge 16 commits from bertyhell/feature/translations-extraction-script
into master
pull from: bertyhell/feature/translations-extraction-script
merge into: topaLE:master
topaLE:1.6.X
topaLE:1.7.X
topaLE:1.9.X
topaLE:Mikhail5555/feature/remote-header-auth
topaLE:Nuckerr/master
topaLE:Saibamen/fix_871
topaLE:WillianRod/feat/add-favicon-badges
topaLE:andreasbrett/logging
topaLE:andreasbrett/securepush
topaLE:bertyhell/bugfix/heartbeat-bar-animation
topaLE:bertyhell/feature/monitor-checks
topaLE:cert-notification
topaLE:chakflying/settings-redesign
topaLE:debian-docker
topaLE:deefdragon/Template-Engine
topaLE:deefdragon/notif-tests
topaLE:e2e-test
topaLE:fdcastel/push-api-tags
topaLE:free-disk-space
topaLE:ivanbratovic/http-basicauth
topaLE:ivanbratovic/improve-translatables
topaLE:k8s-unofficial
topaLE:lucasra1/overall_status
topaLE:master
topaLE:mhkarimi1383/master
topaLE:mrphuongbn/master
topaLE:no-need-build
topaLE:philippdormann/feature/release-management
topaLE:proffalken/feature/680_add_labels_to_prometheus_metrics
topaLE:proffalken/feature/auto_build_and_release
topaLE:rebasesoftware/feature/request-with-http-proxy
topaLE:restructure-status-page
topaLE:sqlite-upgrade-prebuilt
topaLE:tarun7singh/master
topaLE:thomasleveil/feature/565-duplicate-monitor
topaLE:thomasleveil/ux/add-group-at-the-top
Reviewers
Request review
No reviewers
Labels
Something isn't working dependencies
Pull requests that update a dependency file discussion doc
Improvements or additions to documentation duplicate
This issue or pull request already exists feature-request
New feature or request good first issue
Good for newcomers hacktoberfest hacktoberfest-accepted help help wanted
Extra attention is needed High
High Priority impossible invalid
This doesn't seem right investigating k8s Low
Low Priority Medium
Medium Priority News prerelease bug question
Further information is requested resolved Unknown wontfix
This will not be worked on
Apply labels
Clear labels
bug
Something isn't working dependencies
Pull requests that update a dependency file discussion doc
Improvements or additions to documentation duplicate
This issue or pull request already exists feature-request
New feature or request good first issue
Good for newcomers hacktoberfest hacktoberfest-accepted help help wanted
Extra attention is needed High
High Priority impossible invalid
This doesn't seem right investigating k8s Low
Low Priority Medium
Medium Priority News prerelease bug question
Further information is requested resolved Unknown wontfix
This will not be worked on
No Label
bug
dependencies
discussion
doc
duplicate
feature-request
good first issue
hacktoberfest
hacktoberfest-accepted
help
help wanted
High
impossible
invalid
investigating
k8s
Low
Medium
News
prerelease bug
question
resolved
Unknown
wontfix
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
This pull request currently doesn't have any dependencies.
Reference in new issue
There is no content yet.
Delete Branch 'bertyhell/feature/translations-extraction-script'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
Extracts the translations from the source code
and adds the missing translations to the language files
No changes have been made to the case of the translation keys. See Discussion: https://github.com/louislam/uptime-kuma/pull/568#issuecomment-936605632
Any translations that cannot be automatically added show up as warnings.
Any translations that are in the translation files but are not used also show up as a warning.
After running the script the translation file changes look like this:
I've not included the output of the script in this PR to keep is small and easy for @louislam to review. Once the script is accepted @louislam or me can run the script and commit the output in a separate PR.
We might even be able to run this script as a pre-commit hook in the future using husky.
Please revert any changes related to
package-lock.json
to avoid merge conflictsdone
should package-lock never be committed?
Lot of changes can happen before PRs will be merged to master, so IMO it is safer to not commit lock files in PRs
@louislam can you update tests to install NPM dependencies before testing?
npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with
npm installbefore continuing.
@bertyhell Can you please sync with current master?
done
Missing support for
i18n-t
tagDo we want to do it here? We already have a script for this: https://github.com/louislam/uptime-kuma/blob/master/extra/update-language-files/index.js
Or we can delete
update-language-files
script after merging this PR@Saibamen
Fixed
A single script seems better.
Would you like me to remove the other script in this PR? Or should a make a new PR for that?
Just tested. Overall is a great tool.
However, unfortunately, some keys like
matrixDesc2
also added to all language files. It will be unreadable.My suggestion would be:
en.js
only, no need to extract to all languages.npm run update-language-files
have already done a good job, so since your script added all missing keys toen.js
,update-language-files
can fill all missing keys fromen.js
to all language files peacefully.@louislam Fixed the issue. Now extracted translations in other files will default to English if it's available:
Reviewers