You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using I18n, it will be useful to have GoToDefinition support. Improving the developer experience when working with translations.
Examples:
I18n.t("some-key") in .erb and .rb file.
I18n.translate("some-key") in .erb and .rb file.
Both should go to the definition(s) of that translation(s)
Some considerations:
Changes in the yaml files that have the translations should be considered, the definition must be synced between the I18n backend when their sources changes (exampel: if I change a yaml file es.yml, the go to definition should change too).
I18n could have different/custom translation backends.
My take on this is that this could be implemented in the following way:
Make I18n have the metadata of where is each translation located. This should be opt-in so we only turn it on in development mode, so now the translation I18n.t("key") gives the pair (value, source_location) instead of just the value. This could be done via contribution to I18n or monkey patching in this addon, i prefer the first aproach.
Use the same strategy as Add hover on i18n translations #640 but use a new request that use this new metadata from the I18n running in the rails background process to get the source_location of the translation in the go_to_definition_request.
The key is easily accessible by the AST tree in the I18n.t("string") call.
When using I18n, it will be useful to have GoToDefinition support. Improving the developer experience when working with translations.
Examples:
I18n.t("some-key")in.erband.rbfile.I18n.translate("some-key")in.erband.rbfile.Both should go to the definition(s) of that translation(s)
Some considerations:
My take on this is that this could be implemented in the following way:
I18n.t("key")gives the pair(value, source_location)instead of just the value. This could be done via contribution toI18nor monkey patching in this addon, i prefer the first aproach.The key is easily accessible by the AST tree in the
I18n.t("string")call.