getodk / central-frontend

Vue.js based frontend for ODK Central

Home Page:https://docs.getodk.org/central-intro/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move translated message without requiring retranslation

matthew-white opened this issue · comments

Moving an i18n message means that the message will need to be retranslated in Transifex, because moving it changes its Transifex key. See here for related Transifex documentation.

Retranslation isn't as bad as it sounds, because if a string exactly matches a past string, Transifex will suggest the past translation. However, if retranslation can be avoided, that seems ideal, as it requires some work for each language. Some languages are maintained by a single translator. Some languages are also less actively maintained on Transifex than others, so it can take a while for a string to be retranslated.

There are two main cases in which a message is moved:

  • A component needs to use a message from another component. In most cases, a message is local to the component in which it is used. That allows a component's messages to be loaded async, when the component is loaded. Otherwise, all messages would be loaded at once, which would be a lot of text. However, if a message that was local to a component now needs to be used in a second component, it is typically moved to the shared message file en.json5. That allows both components (and any future components) to access the message. However, because the message is moved, it will need to be retranslated.
  • An entire component is moved. For a message that is local to a component, the message's Transifex key includes the component name, inferred from its file path. However, that means that if the component is renamed and moved, all its translations will have to be retranslated. For example, previously, the submission download modal was only shown if decryption was required — so it was named SubmissionDecrypt. Now, however, it is shown even if decryption isn't required. I've renamed the component to SubmissionDownload, but because I've wanted to avoid retranslation, I haven't moved the file yet: it is still located at src/components/submission/decrypt.vue.

My idea is to introduce a type of magic comment to override a message's default Transifex key. Something like:

{
  // @transifexKey component.SubmissionDecrypt.title
  "title": "Download Submissions",
  // ...
}

That way, we could move submission/decrypt.vue to submission/download.vue while still signaling "use SubmissionDecrypt for the Transifex key".

Things to verify when developing an approach:

  • A component is renamed (e.g., SubmissionDecrypt to SubmissionDownload).
  • A message is moved from a component to en.json5 (e.g., title.entity.create from SubmissionFeedEntry).
  • A message is moved from one component to another.