Skip to content

Remove unnecessary translation keys and messages#1820

Merged
miguelvaara merged 2 commits intomainfrom
issue1813-match-the-translation-tags-in-the-translation-files-with-those-in-the-skosmos-code-and-push-the-changes-to-lokalise
Nov 4, 2025
Merged

Remove unnecessary translation keys and messages#1820
miguelvaara merged 2 commits intomainfrom
issue1813-match-the-translation-tags-in-the-translation-files-with-those-in-the-skosmos-code-and-push-the-changes-to-lokalise

Conversation

@miguelvaara
Copy link
Contributor

@miguelvaara miguelvaara commented Oct 30, 2025

Reasons for creating this PR

We do not want to remove key–message pairs that are likely to be needed for translation again, as that would cause unnecessary and frustrating rework and slow down the completion of translations.

The situation is quite good (around 10 removed), but after the release of Skosmos 3, the list needs to be reviewed again, since some of the key–message pairs used in Skosmos 2 will probably end up unused.

Link to relevant issue(s), if any

#1813

Description of the changes in this PR

When a key–message pair in messages.en.json should be removed

A key–message pair will be removed only if:

  • it is not used in Skosmos 3
  • and it was not used in Skosmos 2 either (the probability of inheritance to Skosmos 3 is rather high)
  • the key–message pair is not generic enough to being propably used later

Searching for and evaluating usage cases

Open the attached file messages.en-checklist.json, where:

  • N → the pair will be removed
  • ?uncertain, difficult to decide

In the Skosmos root directory, run:

grep -nr --include='*.js' --include='*.php' --include='*.twig' "[search text]" [skosmos 2 folder] | grep trans
grep -nr --include='*.js' --include='*.php' --include='*.twig' "[search text]" . | grep trans

Command-line helpers (in Skosmos root directory)

List all found translation keys and their states

Note:
The following command also lists as unused those key-message pairs in the language file whose key and message are identical (even if the message itself is used)

php bin/console debug:translation en

Go through all translation keys found in PHP, JS, and Twig code

bin/console translation:extract en --dump-messages

When the translation file is finalized and merged into main, it can be pushed to Lokalise.


Known problems or uncertainties in this PR

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

messages.en-checklist.json

@miguelvaara miguelvaara requested a review from osma October 30, 2025 13:26
@miguelvaara miguelvaara self-assigned this Oct 30, 2025
@miguelvaara miguelvaara moved this to Needs review in Skosmos 3.x Backlog Oct 30, 2025
@miguelvaara miguelvaara added this to the 3.0 milestone Oct 30, 2025
… to the code according to the suggestions given in the PR review
@sonarqubecloud
Copy link

Copy link
Member

@osma osma left a comment

Choose a reason for hiding this comment

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

LGTM!

@miguelvaara miguelvaara merged commit fba3897 into main Nov 4, 2025
14 checks passed
@github-project-automation github-project-automation bot moved this from Needs review to Issue/PR closed in Skosmos 3.x Backlog Nov 4, 2025
@osma osma modified the milestones: 3.0, 3.0-beta.2 Nov 6, 2025
@osma osma moved this from Issue/PR closed to Done (verified in test.dev.finto.fi, set Milestone 3.0 for both issue & PR, update docs) in Skosmos 3.x Backlog Nov 6, 2025
@osma osma deleted the issue1813-match-the-translation-tags-in-the-translation-files-with-those-in-the-skosmos-code-and-push-the-changes-to-lokalise branch December 5, 2025 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match the translation tags in the translation files with those in the Skosmos code and push the changes to Lokalise

2 participants