Why can WordPress.org theme plugins and readme.txt be automatically loaded into GlotPress

Let’s discuss a technical issue about WordPress and GlotPress. Tell me why themes, plugins, and readme.txt on WordPress.org can be automatically loaded into GlotPress projects and displayed after translation?

This is a meticulously designed automated process within the WordPress.org ecosystem. Let me explain how it works:

The Mechanism for Automatic Loading into GlotPress

  1. SVN Hook Monitoring

When plugin/theme developers commit code to the WordPress.org SVN repository:

  • The SVN server is configured with post-commit hooks
  • These hooks trigger automated scripts to detect new commits
  1. Automated Extraction Process

SVN Commit → Triggers Hook → Scans for file changes

Detects readme.txt or code files

Runs extraction tool (similar to wp i18n make-pot)

Generates/Updates POT file

Automatically imports into the GlotPress project

  1. Core Components

String Extraction:

  • Specific fields in readme.txt (Plugin Name, Description, Tags, etc.)
  • Internationalization functions in PHP code like __(), _e(), esc_html__()
  • Functions in JavaScript like wp.i18n.__()

GlotPress Integration:

  • WordPress.org uses a custom integration layer to connect SVN and GlotPress
  • Corresponding GlotPress projects are automatically created for each plugin/theme
  • Project structure: /plugins/plugin-slug/ and /themes/theme-slug/
  1. Mechanism for Automatic Display After Translation

Building Language Packs:
Translators submit translations in GlotPress

Approval threshold is reached (usually requires editor approval)

Triggers automatic language pack build

Generates .po and .mo files

Packaged into ZIP (includes all translation domains)

Deployed to translate.wordpress.org CDN

Automatic Download by WordPress Sites:
// WordPress core periodically checks
update_translations()

Queries API: api.wordpress.org/translations/plugins/1.0/

Detects available new language packs

Downloads to wp-content/languages/plugins/

Automatically loaded for use

  1. Key Technical Points

API Endpoints:

  • https://api.wordpress.org/translations/plugins/1.0/?slug={plugin-slug}&version={version}
  • Returns metadata for all available language packs for that plugin

Automatic Loading Logic:
// WordPress core when loading a plugin
load_plugin_textdomain('plugin-slug', false, dirname(plugin_basename(__FILE__)) . '/languages');

// If translation files don’t exist locally, they are loaded from the CDN
// wp-content/languages/plugins/plugin-slug-zh_CN.mo

Update Frequency:

  • Language pack build: Within minutes after translation approval
  • WordPress update check: Every 12 hours (via wp-cron)
  • Can also be triggered manually: Dashboard → Updates
  1. Why is it Automatic?

Integration Levels:

  1. SVN → GlotPress: post-commit hooks
  2. GlotPress → Language Packs: cronjob builder
  3. Language Packs → WordPress: core update mechanism

WordPress.org Privileges:

  • This system is part of the official WordPress.org infrastructure
  • Uses internal APIs and direct database access
  • Not implemented via public APIs

If you want to implement a similar system

You need to build the following components:

  1. Code Repository Hooks → Detect commits
  2. String Extractor → Parse POT
  3. GlotPress Integration → Automatic import/export
  4. Build Pipeline → Generate language packs
  5. Distribution API → Provide to clients
  6. Client Updater → Automatically download and load

This is a complete CI/CD + i18n automation system, with the core lying in event-driven automation and standardized file structure.