WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 3 months ago

#18200 accepted task (blessed)

Language Packs

Reported by: nacin Owned by: nacin
Priority: normal Milestone: Future Release
Component: Upgrade/Install Version:
Severity: normal Keywords: 3.7-early has-patch
Cc: ocean90, pavelevap@…, johnbillion@…, dkikizas@…, jottlieb@…, forumi@…, ofer+wptrac@…, scribu, viper007bond, gary@…, remkus@…, sirzooro, frank@…, gary@…, jarlskov, aesqe@…, MZAWeb, knut@…, info@…, CoachBirgit, lancewillett, simon@…, wordpress@…, ipstenu@…, nashwan.doaqan@…, code@…

Description (last modified by nacin)

Implement language packs for core, plugins, and themes.

Inspiration and code can hopefully be derived from the corresponding GSoC project.

This will require quite a bit of work in GlotPress, on api.wordpress.org, and in core. I will take point, but assistance will be needed. A number of decisions will need to be made. I will begin designing a document for what exactly needs to be done over the next week.

Attachments (9)

18200.diff (15.1 KB) - added by nacin 2 years ago.
lp.diff (12.1 KB) - added by dd32 16 months ago.
patch.diff (11.4 KB) - added by dd32 16 months ago.
refresh of last alterations
lp.2.diff (15.0 KB) - added by dd32 15 months ago.
lp.3.diff (17.5 KB) - added by dd32 15 months ago.
lp.4.diff (16.0 KB) - added by dd32 9 months ago.
Refreshed patch - completely untested
no_plugin_overwrite.patch (1.8 KB) - added by dimadin 6 months ago.
lp.5.diff (17.9 KB) - added by dimadin 6 months ago.
Refreshed patch, tested as described in comment:ticket:18200:43
fake-api-response.php (3.2 KB) - added by dimadin 6 months ago.
Plugin used to test attachment:ticket:18200:lp.5.diff as described in comment:ticket:18200:43

Download all attachments as: .zip

Change History (56)

comment:1 nacin2 years ago

  • Description modified (diff)

comment:2 pavelevap2 years ago

  • Cc pavelevap@… added

comment:3 johnbillion2 years ago

  • Cc johnbillion@… added

nacin2 years ago

comment:4 follow-up: nacin2 years ago

Two files are currently hard-coded and committed into SVN by translators: setup-config.php, and wp-config-sample.php.

18200.diff implements WP_I18N in setup-config.php. It does not yet touch the default constant values, which must match wp-config-sample.php (and code exists on WP.org to verify this).

The goal would be for these strings to be implemented directly into GlotPress and for wp-config-sample.php to then be filled out in Rosetta. (Rosetta is the code and associated tools that power the local language sites, such as http://pt.wordpress.org/.) This will then remove the SVN requirement for nearly all core packages. (I haven't gotten into $locale.php or special plugins yet, but we will.)

comment:5 nacin2 years ago

A sanity check on my syntax for this patch would be appreciated. Untested and I may have missed a string.

comment:6 in reply to: ↑ 4 SergeyBiryukov2 years ago

Replying to nacin:

Two files are currently hard-coded and committed into SVN by translators: setup-config.php, and wp-config-sample.php.

There's also:

  • readme.html
  • $wp_default_secret_key in default-constants.php (not required, but prevents the admin area from breaking after installing some plugins, see #14024 and the post on WP Polyglots)

Replying to nacin:

A sanity check on my syntax for this patch would be appreciated.

Tested installation, works fine. Minor correction in line 85:

'WordPress › Setup Configuration File'/*WP_I18N_SETUP_CONFIG_EXISTS*/;

Should be:

'WordPress › Setup Configuration File'/*/WP_I18N_SETUP_TITLE*/;
Last edited 2 years ago by SergeyBiryukov (previous) (diff)

comment:7 nacin2 years ago

Re-opened #18180 and will continue setup-config.php conversation there.

comment:8 demetris2 years ago

  • Cc dkikizas@… added

comment:10 jottlieb23 months ago

  • Cc jottlieb@… added

comment:11 dimadin23 months ago

  • Cc forumi@… added

Related: #15977

comment:12 oferwald23 months ago

  • Cc ofer+wptrac@… added

comment:13 scribu21 months ago

  • Cc scribu added

comment:14 Viper007Bond21 months ago

  • Cc viper007bond added

comment:15 GaryJ21 months ago

  • Cc gary@… added

comment:16 jane21 months ago

  • Keywords 3.4-early added
  • Milestone changed from 3.3 to Future Release

It was decided at last week's dev chat to punt this because we are past freeze and it's not quite done. Hopefully it will be ready as soon as we open the 3.4 branch.

comment:17 defries21 months ago

  • Cc remkus@… added

comment:18 sirzooro20 months ago

  • Cc sirzooro added

comment:19 bueltge20 months ago

  • Cc frank@… added

comment:20 pento19 months ago

  • Cc gary@… added

comment:21 jarlskov19 months ago

  • Cc jarlskov added

comment:23 aesqe19 months ago

  • Cc aesqe@… added

comment:24 MZAWeb19 months ago

  • Cc MZAWeb added

comment:26 knutsp17 months ago

  • Cc knut@… added

dd3216 months ago

comment:27 ocean9016 months ago

  • Cc ocean90 added

dd3216 months ago

refresh of last alterations

dd3215 months ago

dd3215 months ago

comment:28 dimadin11 months ago

Oh, dd32, why you didn't post a comment, we could have never seen this patch? :)

Anyway, I'll try to summarize what this patch does so you correct me where I'm wrong:

  • On core/plugins/themes check for updates, we now check for languages too.
  • Checks for languages are done by searching for language files in WP_LANG_DIR, from which is then PO-Revision-Date taken to be sent to api.wp.org.
  • When any install/upgrade of core/plugin/theme is done, rechecks for updates are forced for everything so that there are fresh results against latest versions.
  • After that, upgrades for available languages updates for everything (core/plugins/themes) are forced.

comment:29 scribu11 months ago

  • Keywords has-patch added

comment:30 dd3211 months ago

Oh, dd32, why you didn't post a comment, we could have never seen this patch? :)

Because the patch is more than useless without the WordPress.org infrastructure being setup (And it wasn't set up, and still isn't ready). Those that needed to know there's a patch here knew about it :)

The overview of what you've said sounds about right for the process it'd be doing.

comment:31 nacin11 months ago

  • Milestone changed from Future Release to 3.5

Considering this for 3.5 for bundled themes and importers.

comment:32 toscho9 months ago

  • Cc info@… added

dd329 months ago

Refreshed patch - completely untested

comment:33 ocean909 months ago

Do we have the WordPress.org infrastructure now?

comment:34 CoachBirgit9 months ago

  • Cc CoachBirgit added

comment:35 lancewillett9 months ago

  • Cc lancewillett added

comment:36 dd328 months ago

  • Milestone changed from 3.5 to Future Release

Language Packs are currently blocked by needing WordPress.org development, Shifting out of 3.5 since it won't be included.

comment:37 dd328 months ago

In 22346:

Theme Translations: Allow for theme pomo files to be loaded from WP_LANG_DIR/themes/{$domain}-{$locale}.(p|m)o.
This directory format is what we have chosen for Language Packs (See #18200), but which is currently delayed.

By making this change, we can ship localised theme files within core for bundled themes, and avoid the issues associated with Theme Updates overwriting/removing the language files.

Fixes #18960

comment:38 simonwheatley7 months ago

  • Cc simon@… added

comment:39 TobiasBg7 months ago

  • Cc wordpress@… added

comment:40 dimadin6 months ago

Attached patch implements changes from [22346] to plugins.

comment:41 scribu6 months ago

  • Milestone changed from Future Release to 3.6

comment:42 Ipstenu6 months ago

  • Cc ipstenu@… added

comment:43 dimadin6 months ago

Non-blocking

I disagree that this needs to wait WordPress.org infrastructure before inclusion in core. The way this should work based on proposed patch is that when there is no WordPress.org infrastructure it won’t return anything language related so it would simply work as before.

This means that infrastructure might get ready late in release cycle, or even after release, and in that time we’ll have core side done and tested. Core support doesn’t require API (api.wordpress.org) support, it’s only required if you want to have it as an official feature.

Probably, in beginning there will be need for some change in API’s response so that response can be able to hold information for a few language-core/plugin/theme combinations that would have pre-made static language packages for testing purposes. This shouldn’t require too much changes.

Testing

I tested patch by @dd32. Everything in install/upgrade of core/plugins/themes worked as usual so there is nothing breaking. For packs, even if response had language information, nothing would happen since patch doesn’t save that data.

So I modified it (see attached patch) with presumption that structure of API responses is same. Response for core is already structured so that there are a couple of keys with different content and it would simply access one more for languages. Plugins and themes responses offer arrays where first level keys are names of plugins/themes so it just checks for language_updates key and unsets it.

Then I forced response to hold language information with pre-made packages (see attached plugin).

With language_updates available, upgrader would download and extract language files as expected.

Improvements

There are possible improvements to this core workflow:

  • API responses for plugins/themes should change to be in line with core one (current array of updates can be under offers key, with languages under language_updates).
  • API requests should have one more key along installed_languages that carries language codes so that site can get language files even if there aren’t installed language files.
  • On unistallation of plugin/theme, associate language files should be deleted too.
  • Action links on upgrader screen should be maybe shown after language updates are done to avoid possible interruption caused by user’s click on those links.

GlotPress

On GP side, I added some related patches, like introducing hooks when translation is changed (to rebuild package) or projects branching. I have other ideas for GP improvements but that’s blocked by lack of any development over there.

Conclusion

I propose that core support for language packs lands early in 3.6 cycle. This would give enough time for testing and shift attention to WordPress.org and GlotPress since they need a lot more changes.

dimadin6 months ago

Refreshed patch, tested as described in comment:ticket:18200:43

dimadin6 months ago

comment:44 alex-ye4 months ago

  • Cc nashwan.doaqan@… added

comment:45 tar.gz3 months ago

  • Cc code@… added

comment:46 nacin3 months ago

  • Keywords 3.7-early added; 3.4-early removed
  • Milestone changed from 3.6 to Future Release
  • Owner set to nacin
  • Status changed from new to accepted

comment:47 nacin3 months ago

In 23912:

WP_Upgrader: Add upgrader_process_complete hooks and add a abort_if_destination_exists flag (default is true). props dd32. see #18200.

Note: See TracTickets for help on using tickets.