Skip to content

Pootle project tool

Taras Semenenko edited this page Feb 23, 2017 · 16 revisions

Aims

  • provide access to tp_tool api
  • clone tps within/between projects
  • move tps within/between projects
  • update some/all of 1 tp from another
  • clone projects
  • move projects

Actions that are needed on units

  • Template actions:

    • Add missing units from source to target
    • Remove units missing in source from target
    • Adjust source of a unit in target
  • Target translation actions:

    • Copy translations from source unit to target unit
      • Copy only if blank
      • Copy only if source unit is newer than target unit

Commands

--target-language can be set with one --language parameter only. It will perform all actions on TP-SOURCE->TP-TARGET.

clone

pootle project clone foo --target-project=baz [--language=…]*
pootle project clone foo --language=pt --target-project=baz --target-language=pt-BR

move

pootle project move foo --target-project=baz [--language=…]*
pootle project move foo --language=pt --target-project=baz --target-language=pt-BR

update

pootle project update foo --target-project=baz [--translations][--overwrite][--language=…]*
pootle project update foo --target-project=baz --language=pt --target-language=pt-BR [--translations][--overwrite]

Runs standard update process baz project from foo project. NEED TO CLARIFY. SEE EXAMPLE BELOW.

If --translations is set it updates translations only. No new units can be added. No existing units can be marked as obsolete.

Example:

  • there are two projects (PRJ1, PRJ2)
  • sometimes we need to update /LANG/PRJ1 from /LANG/PRJ2
  • edit unit in /LANG/PRJ1
  • run
project update PRJ1 --language=LANG1 --target-project=PRJ2 --target-language=LANG2

What can we do if unit was already translated in /LANG/PRJ2:

  • overwrite translation without suggestion (available --overwrite => source_revision = target.max_revision + 1)
  • overwrite translation, add existing translation as suggestion (source_revision=0, SOURCE_WINS)
  • add new translation as suggestion (source_revision=0, POOTLE_WINS)
  • do nothing (source_revision=0, POOTLE_WINS, --no-suggestions)

Current available options: --overwrite. NEED TO ADD MORE OPTIONS.

Having to say: Current conflict detecting logic for FS updating relies on last_sync_revision

if overwrite: 
    store_revision = self.target_store.data.max_unit_revision
else:
    store_revision = self.target_store.last_sync_revision or 0

There is no last_sync_revision if we update a store from another store within Pootle however unit revision can be available (probs we can think about this later). Currently source_revision is set to 0 what leads to resolving conflicts in any case when source and target units are translated and their translation are not the same.

remove

pootle project remove foo [--force] [--language=…]*

--force can be used for the whole project only and removes project directory from PO_DIRECTORY

Clone this wiki locally