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

Removing Unused Translation Strings #7437

Closed
wants to merge 7 commits into from

Conversation

AaronPresley
Copy link
Contributor

@AaronPresley AaronPresley commented Feb 28, 2023

What does this PR do?

This PR introduces a new script that checks whether the primary language's translation file(s) have a translation string that's not being used within the codebase itself. This script does not automatically run, and is simply intended to be run periodically.

Also part of this PR is the removal of the 485 unused keys that the script detected.

🎉 485 unused keys * 34 supported languages = 16,490 total keys that no longer have to be managed 🎉

See this README.md for full script documentation.

Environment: Production

Type of change

  • Chore (refactoring code, technical debt, workflow improvements)

How should this be tested?

  • Launch the app in any given language
  • Ensure that there are no missing translations

@vercel
Copy link

vercel bot commented Feb 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
ui ⬜️ Ignored (Inspect) Visit Preview Mar 1, 2023 at 5:45PM (UTC)

@vercel
Copy link

vercel bot commented Feb 28, 2023

@AaronPresley is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2023

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

This PR introduced no changes to the javascript bundle 🙌

@AaronPresley AaronPresley marked this pull request as ready for review February 28, 2023 21:48
@AaronPresley AaronPresley requested review from a team February 28, 2023 21:48
@PeerRich PeerRich requested a review from emrysal March 1, 2023 11:53
@PeerRich
Copy link
Member

PeerRich commented Mar 1, 2023

i wonder, do we need this script in the repo or can we just run this every 4 months manually?

@AaronPresley
Copy link
Contributor Author

i wonder, do we need this script in the repo or can we just run this every 4 months manually?

@PeerRich up to you, but I assume you'd prefer to be able to run this script regardless of my ongoing direct involvement in the project. It's a pretty simple script with no new dependencies that weren't already being used (glob).

AaronPresley and others added 2 commits March 1, 2023 09:25
# Conflicts:
#	apps/web/public/static/locales/ar/common.json
#	apps/web/public/static/locales/cs/common.json
#	apps/web/public/static/locales/da/common.json
#	apps/web/public/static/locales/de/common.json
#	apps/web/public/static/locales/es/common.json
#	apps/web/public/static/locales/fr/common.json
#	apps/web/public/static/locales/he/common.json
#	apps/web/public/static/locales/id/common.json
#	apps/web/public/static/locales/it/common.json
#	apps/web/public/static/locales/ja/common.json
#	apps/web/public/static/locales/ko/common.json
#	apps/web/public/static/locales/nl/common.json
#	apps/web/public/static/locales/no/common.json
#	apps/web/public/static/locales/pl/common.json
#	apps/web/public/static/locales/pt-BR/common.json
#	apps/web/public/static/locales/pt/common.json
#	apps/web/public/static/locales/ro/common.json
#	apps/web/public/static/locales/ru/common.json
#	apps/web/public/static/locales/sr/common.json
#	apps/web/public/static/locales/sv/common.json
#	apps/web/public/static/locales/tr/common.json
#	apps/web/public/static/locales/uk/common.json
#	apps/web/public/static/locales/vi/common.json
#	apps/web/public/static/locales/zh-CN/common.json
#	apps/web/public/static/locales/zh-TW/common.json
packages/tslint/package.json Outdated Show resolved Hide resolved
Copy link
Member

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Left some nitpicks but overall pretty nice! Thank you for your contribution 🙏 @AaronPresley

@AaronPresley AaronPresley changed the title Created a new script that helps understand which translatable strings… Removing Unused Translation Strings Mar 1, 2023
"confirmed_event_type_subject": "Confirmed: {{eventType}} with {{name}} at {{date}}",
"new_event_request": "New event request: {{attendeeName}} - {{date}} - {{eventType}}",
"confirm_or_reject_request": "Confirm or reject the request",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is being used in organizer-request-email.ts

"event_type_has_been_rescheduled_on_time_date": "Your {{title}} has been rescheduled to {{date}}.",
"event_has_been_rescheduled": "Updated - Your event has been rescheduled",
"request_reschedule_title_attendee": "Request to reschedule your booking",
"request_reschedule_subtitle": "{{organizer}} has cancelled the booking and requested you to pick another time.",
"request_reschedule_title_organizer": "You have requested {{attendee}} to reschedule",
"request_reschedule_subtitle_organizer": "You have cancelled the booking and {{attendee}} should pick a new booking time with you.",
"rescheduled_event_type_subject": "Request for reschedule sent: {{eventType}} with {{name}} at {{date}}",
"requested_to_reschedule_subject_attendee": "Action Required Reschedule: Please book a new time for {{eventType}} with {{name}}",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is being used in attendee-was-requested-to-reschedule-email.ts

"create_account": "Create Account",
"confirm_password": "Confirm password",
"create_your_account": "Create your account",
"sign_up": "Sign up",
"youve_been_logged_out": "You've been logged out",
"hope_to_see_you_soon": "We hope to see you again soon!",
"logged_out": "Logged out",
"please_try_again_and_contact_us": "Please try again and contact us if the issue persists.",
Copy link
Contributor

Choose a reason for hiding this comment

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

it is used in two files

"create_account": "Create Account",
"confirm_password": "Confirm password",
"create_your_account": "Create your account",
"sign_up": "Sign up",
"youve_been_logged_out": "You've been logged out",
"hope_to_see_you_soon": "We hope to see you again soon!",
"logged_out": "Logged out",
"please_try_again_and_contact_us": "Please try again and contact us if the issue persists.",
"incorrect_2fa_code": "Two-factor code is incorrect.",
Copy link
Contributor

Choose a reason for hiding this comment

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

It is also used in two files ( /pages/auth, /pages/settings/my-account)

"finish": "Finish",
"few_sentences_about_yourself": "A few sentences about yourself. This will appear on your personal url page.",
"nearly_there": "Nearly there!",
Copy link
Contributor

Choose a reason for hiding this comment

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

It is used in /getting-started

"finish": "Finish",
"few_sentences_about_yourself": "A few sentences about yourself. This will appear on your personal url page.",
"nearly_there": "Nearly there!",
"nearly_there_instructions": "Last thing, a brief description about you and a photo really help you get bookings and let people know who they’re booking with.",
Copy link
Contributor

Choose a reason for hiding this comment

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

It is also used in /gettting-started

"nearly_there": "Nearly there!",
"nearly_there_instructions": "Last thing, a brief description about you and a photo really help you get bookings and let people know who they’re booking with.",
"set_availability_instructions": "Define ranges of time when you are available on a recurring basis. You can create more of these later and assign them to different calendars.",
"set_availability": "Set your availability",
Copy link
Contributor

Choose a reason for hiding this comment

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

used in /getting-started

"set_availability_instructions": "Define ranges of time when you are available on a recurring basis. You can create more of these later and assign them to different calendars.",
"set_availability": "Set your availability",
"continue_without_calendar": "Continue without calendar",
"connect_your_calendar": "Connect your calendar",
Copy link
Contributor

Choose a reason for hiding this comment

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

used in getting-started

"event_is_in_the_past": "The event is in the past",
"cancelling_event_recurring": "The event is one instance of a recurring event.",
"cancelling_all_recurring": "These are all remaining instances in the recurring event.",
"error_with_status_code_occured": "An error with status code {{status}} occurred.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is also being used

"installed_app_calendar_description": "Set the calendars to check for conflicts to prevent double bookings.",
"installed_app_conferencing_description": "Add your favourite video conferencing apps for your meetings",
"installed_app_payment_description": "Configure which payment processing services to use when charging your clients.",
Copy link
Contributor

Choose a reason for hiding this comment

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

this key has not beein deleted from other translation files

"installed_app_calendar_description": "Set the calendars to check for conflicts to prevent double bookings.",
"installed_app_conferencing_description": "Add your favourite video conferencing apps for your meetings",
"installed_app_payment_description": "Configure which payment processing services to use when charging your clients.",
"installed_app_analytics_description": "Configure which analytics apps to use for your booking pages",
Copy link
Contributor

Choose a reason for hiding this comment

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

this key has not beein deleted from other translation files

"installed_app_conferencing_description": "Add your favourite video conferencing apps for your meetings",
"installed_app_payment_description": "Configure which payment processing services to use when charging your clients.",
"installed_app_analytics_description": "Configure which analytics apps to use for your booking pages",
"installed_app_other_description": "All your installed apps from other categories.",
Copy link
Contributor

Choose a reason for hiding this comment

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

this key has not beein deleted from other translation files

"installed_app_payment_description": "Configure which payment processing services to use when charging your clients.",
"installed_app_analytics_description": "Configure which analytics apps to use for your booking pages",
"installed_app_other_description": "All your installed apps from other categories.",
"installed_app_automation_description": "Configure which automation apps to use",
Copy link
Contributor

Choose a reason for hiding this comment

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

this key has not beein deleted from other translation files

"installed_app_analytics_description": "Configure which analytics apps to use for your booking pages",
"installed_app_other_description": "All your installed apps from other categories.",
"installed_app_automation_description": "Configure which automation apps to use",
"installed_app_web3_description": "Configure which web3 apps to use for your booking pages",
Copy link
Contributor

Choose a reason for hiding this comment

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

this key has not beein deleted from other translation files

"trigger": "Trigger",
"triggers": "Triggers",
"action": "Action",
"workflows_to_automate_notifications": "Create workflows to automate notifications and reminders",
"workflow_name": "Workflow name",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"email_body": "Email body",
"subject": "Email subject",
"text_message": "Text message",
"specific_issue": "Have a specific issue?",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"rainbow_connect_wallet_gate": "Connect your wallet if you own <1>{{name}}</1> (<3>{{symbol}}</3>).",
"rainbow_insufficient_balance": "Your connected wallet doesn't contain enough <1>{{symbol}}</1>.",
"rainbow_sign_message_request": "Sign the message request on your wallet.",
"rainbow_signature_error": "Error requesting signature from your wallet.",
"token_address": "Token Address",
"blockchain": "Blockchain",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"old_password": "Old password",
"secure_password": "Your new super secure password",
"error_updating_password": "Error updating password",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"general_description": "Manage settings for your language and timezone",
"calendars_description": "Configure how your event types interact with your calendars",
"appearance_description": "Manage settings for your booking appearance",
"conferencing_description": "Add your favourite video conferencing apps for your meetings",
"password_description": "Manage settings for your account passwords",
"2fa_description": "Manage settings for your account passwords",
"we_just_need_basic_info": "We just need some basic info to get your profile setup.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"we_just_need_basic_info": "We just need some basic info to get your profile setup.",
"skip": "Skip",
"do_this_later": "Do this later",
"set_availability_getting_started_subtitle_1": "Define ranges of time when you are available",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"skip": "Skip",
"do_this_later": "Do this later",
"set_availability_getting_started_subtitle_1": "Define ranges of time when you are available",
"set_availability_getting_started_subtitle_2": "You can customise all of this later in the availability page.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

@@ -1272,11 +838,7 @@
"workflow_example_4": "Send email reminder 1 hour before events starts to attendee",
"workflow_example_5": "Send custom email when event is rescheduled to host",
"workflow_example_6": "Send custom SMS when new event is booked to host",
"welcome_to_cal_header": "Welcome to {{appName}}!",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is being used

@@ -1272,11 +838,7 @@
"workflow_example_4": "Send email reminder 1 hour before events starts to attendee",
"workflow_example_5": "Send custom email when event is rescheduled to host",
"workflow_example_6": "Send custom SMS when new event is booked to host",
"welcome_to_cal_header": "Welcome to {{appName}}!",
"edit_form_later_subtitle": "You’ll be able to edit this later.",
Copy link
Contributor

Choose a reason for hiding this comment

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

this key is being used

@@ -1272,11 +838,7 @@
"workflow_example_4": "Send email reminder 1 hour before events starts to attendee",
"workflow_example_5": "Send custom email when event is rescheduled to host",
"workflow_example_6": "Send custom SMS when new event is booked to host",
"welcome_to_cal_header": "Welcome to {{appName}}!",
"edit_form_later_subtitle": "You’ll be able to edit this later.",
"connect_calendar_later": "I'll connect my calendar later",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"create_first_api_key": "Create your first API key",
"create_first_api_key_description": "API keys allow other apps to communicate with {{appName}}",
"back_to_signin": "Back to sign in",
"reset_link_sent": "Reset link sent",
"password_reset_email": "An email is on it’s way to {{email}} with instructions to reset your password.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

"create_first_api_key": "Create your first API key",
"create_first_api_key_description": "API keys allow other apps to communicate with {{appName}}",
"back_to_signin": "Back to sign in",
"reset_link_sent": "Reset link sent",
"password_reset_email": "An email is on it’s way to {{email}} with instructions to reset your password.",
"password_reset_leading": "If you don't receive an email soon, check that the email address you entered is correct, check your spam folder or reach out to support if the issue persists.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is being used

@@ -1515,12 +1034,9 @@
"minimum_round_robin_hosts_count": "Number of hosts required to attend",
"hosts": "Hosts",
"upgrade_to_enable_feature": "You need to create a team to enable this feature. Click to create a team.",
"new_attendee": "New Attendee",
Copy link
Contributor

@Udit-takkar Udit-takkar Mar 8, 2023

Choose a reason for hiding this comment

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

This key is being used

@@ -1515,12 +1034,9 @@
"minimum_round_robin_hosts_count": "Number of hosts required to attend",
"hosts": "Hosts",
"upgrade_to_enable_feature": "You need to create a team to enable this feature. Click to create a team.",
"new_attendee": "New Attendee",
"awaiting_approval": "Awaiting Approval",
Copy link
Contributor

@Udit-takkar Udit-takkar Mar 8, 2023

Choose a reason for hiding this comment

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

This key is being used

"requires_google_calendar": "This app requires a Google Calendar connection",
"connected_google_calendar": "You have connected a Google Calendar account.",
"using_meet_requires_calendar": "Using Google Meet requires a connected Google Calendar",
"continue_to_install_google_calendar": "Continue to install Google Calendar",
Copy link
Contributor

@Udit-takkar Udit-takkar Mar 8, 2023

Choose a reason for hiding this comment

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

This key is being used

Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

Found a lot of keys that are being used in the code but removed in the en.json file.

@PeerRich
Copy link
Member

PeerRich commented Mar 8, 2023

great catch @Udit-takkar!

@AaronPresley can you check why your script falsely removed the used string?

@PeerRich PeerRich added ♻️ autoupdate tells kodiak to keep this branch up-to-date automerge labels Mar 9, 2023
@kodiakhq kodiakhq bot removed the automerge label Mar 9, 2023
@kodiakhq
Copy link
Contributor

kodiakhq bot commented Mar 9, 2023

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@PeerRich PeerRich removed the ♻️ autoupdate tells kodiak to keep this branch up-to-date label Mar 9, 2023
@AaronPresley
Copy link
Contributor Author

Hello, all 👋

Firstly, huge thanks to @Udit-takkar for your thorough review. I did find instances where my script was incorrectly identifying a string as "missing" when it was in fact being used. I've updated my script to include a much more thorough review of the codebase and identify other areas where a given key could be used in other ways.

Unfortunately, a script like this is always imperfect. Ultimately it requires looking into each individual key and make a judgement whether it's proper to remove. A huge change like this also causes a lot of potential merge conflicts which continue to pile on.

Unfortunately I don't have the time or capacity to finish out this change, and for that I apologize. Therefore I'll be closing this PR. However, I have created Issue #7646 which includes a summary of my script's findings in greater detail. My hope is that by making this information available as an Issue, it will be easier to make small improvements over time (vs a passive PR that's very difficult to review).

Please check out the issue for further details, and a better breakdown on where and how a given key is being used through the codebase.

And one more thanks to @Udit-takkar for the time you took to review this PR 🙏

@emrysal
Copy link
Contributor

emrysal commented Mar 9, 2023

@AaronPresley Thanks for trying! I was keeping an eye on this to ensure I could review it rapidly as it is conflicting immediately otherwise - but I agree with your point and realise how hard this is; We'll take it from here 🙌

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.

None yet

5 participants