tolgee / tolgee-cli

The Tolgee CLI
MIT License
16 stars 11 forks source link

Pulling translations by specific datetime #67

Closed amir2mi closed 9 months ago

amir2mi commented 9 months ago

I've read the API documents and Tolgee CLI, but there was no option to get translations providing a date range, like a snapshot of all the translations at that specific datetime.

Use Case

I use the Tolgee CLI to pull the translations at build time. It means if I rebuild the last week build, it probably will have some missing or changed translations, because the pulled translations are always the last version of changes.

A new feature?

I see that the Tolgee has a great history per translation key, so I was wondering if it is possible to pull translations like this:

tolgee pull ./public/i18n --api-key=my_api_key --until="2024-01-02T11:00:00.137Z"
cyyynthia commented 9 months ago

The problem is that while Tolgee does have a detailed log of changes, it is not based on snapshots (as this would be inefficient) but as a log of pre-processed diffs (since they're used for display purposes, it's what makes the most sense). To get the translations as they were back on , the backend (or the CLI) would need to pull all the diffs and work its way backwards to restore the state translations were at this time diff-by-diff which can quickly become a very costly process.

A much easier process would be to tweak your build process, so that it pulls strings and stores them somewhere as a snapshot, so that subsequent builds can reuse the same translation data. This avoids having to deal with the complex data manipulations required to achieve this.

amir2mi commented 9 months ago

Thanks. That makes sense, though having the mentioned feature would be cool as well!