ruby-lsp-rails
ruby-lsp-rails copied to clipboard
Add hover on i18n translations
First implementation for I18n support (#639)
How it works
- Attach file watcher for all translation files
- Add server request to reload translations on file changes. The reload is fast because does not need to reload the entire rails server, just the I18n.
- Add server request to get I18n translations for all locales available in the I18n backend.
- On hover of
I18n.t("hello")key string argument, request the server all the translations available and provide hover info for that.
It address points 1 and 2 of the issue list:
- Read what the translation says. e.g., I18n.t("hello") returns en: "Hello World", es: "¡Hola Mundo!".
- Find out if a translation is missing.
And is usefull for updating and creating translations because it gives feedback that the used translations "is correct" because makes direct calls to the I18n backend while typing and hovering it. Warning if the translation is missing.
This gives the following experience: Screencast from 2025-07-27 00-40-33.webm