Skip to content

Translation process

Gerrit Uitslag edited this page Jan 24, 2023 · 11 revisions

The translation process is divided with the following steps:

  1. An author add plugin to the tool (/plugin) (repository state: waiting) - See Add New Plugin Form

  2. two ways:

    a. The author confirms the activation mail (/plugin/{name}/activate/{key}) (repository state: initialProcessing)

    b. alternative: server admin adds plugin directly using dokuwiki:add command (repository state: initialProcessing)

  3. Regular cronJob creates a remote fork and a local git clone of the extension from its Git repository

  4. This regular cronJob process subsequently the translation files to a local format of serialized LocalText arrays

  5. From now, a user can create a new translation (/translate/plugin/<name>) - See Translation Form

    Results in TranslationUpdateEntity added with an id and state 'undone' and the translation stored in [datafolder]/<type>/<name>/updates/<id>.update

  6. A 5 min cronjob will pick up the pending updates. In that process the translation is transformed to language file and send to the extension author.

Regulary Cronjobs:

  • Every 5 min:

    For all repositories which: >agetoupdate,max updateperrun and <max errors perform:

    Repository->update()

    • basepath: [datafolder]/<type>/<name> e.g. [datafolder]/plugin/indexmenu
    • create dir if not existing, set lock
    • update from remote:
      • if repository exists, pull changes and push to fork, else:
      • create remote fork (if github) in the account https://github.com/dokuwiki-translate
      • create local clone in [datafolder]/<type>/<name>/repository
      • if fork or clone fails, delete whole [datafolder]/<type>/<name>/ folder
    • if success:
      • reset error count and last update time
      • if 'initialProcessing' it set repository state to 'active' and sent extension ready mail
    • if failed:
      • set error and sent error mail

    If Repository had changes, do update to language files stored locally from this repository:

    • Retrieve extension or core specific array of folders with language files
    • Search 'en/' and the other language folders in these folders
    • Collect per language the files:
      • .php-files are parsed with LanguageFileParser as LocalText of type 'array', including an AuthorList
      • .txt-files are parsed as LocalText of type 'markup'
    • Use the RepositoryStats service to clear stats for this Repository
    • Use the RepositoryStats service to create per language of the Repository a LanguageStatsEntity with a score

    For all TranslationUpdateEntities with state 'undone'(i.e. stored translations from users) perform:

    • get its Repository
    • create patch and sent it
      • make folder [datafolder]/<type>/<name>/tmp
      • create local clone in [datafolder]/<type>/<name>/tmp
      • get array with LocalText objects from [datafolder]/<type>/<name>/updates/<id>.update
      • add for each LocalText a language file to local git
      • commit the additions to local git
      • remoteadd 'github', branch 'lang_update_', checkout, push to 'github'
      • create pull request
    • if failed:
      • set error and set error mail
    • remove temporary folder

    Finalize by sending all the mail in the spool.

  • At start of every day:

    Update info from the (old) pluginrepo api and store serialized arrays of Repositories in [datafolder]/dokuwikiRepositoryAPI.ser

Read more!

Process

Files

Maintenance/development

Documentation

Clone this wiki locally