Make WordPress Core

Opened 10 years ago

Closed 8 years ago

#27050 closed enhancement (wontfix)

Allow to load locales from `WP_LANG_DIR."/$locale/$locale.php"`

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: I18N Keywords:
Focuses: Cc:

Description

WP has a hard-coded locale file location, in WP_LANG_DIR.

There are a few pull requests in the composer/installers project that rejected the idea of adding a wordpress-language type because the language "packages" were, well… files… instead of folders that can be uniquely identified and deleted by composer during updates. For instance:

https://github.com/woothemes/woocommerce/pull/760

There's a workaround, of course, e.g. defining WP_LANG_DIR as WP_CONTENT_DIR."/languages/".WPLANG, but it's kind of messy because a plugin might want to override WPLANG (and WP_LANG_DIR is defined before they load), and one then needs to write a composer plugin (or abuse the wordpress-plugin type) to make the needed files install where wanted.

In the interest of re-submitting the relevant pull request in composer/installers, I'd like to suggest that we try loading locale files from two locations:

  1. the current one for backwards compatibility
  2. a composer-friendlier one

Attachments (2)

27050.diff (690 bytes) - added by Denis-de-Bernardy 10 years ago.
27050.2.diff (691 bytes) - added by Denis-de-Bernardy 10 years ago.
fix space

Download all attachments as: .zip

Change History (10)

@Denis-de-Bernardy
10 years ago

fix space

#1 @Denis-de-Bernardy
10 years ago

Arf… Just realized I posted a link to the wrong pull request. Was meant:

https://github.com/composer/installers/pull/112

Also of interest:

https://github.com/roots/bedrock/issues/30

Last edited 10 years ago by Denis-de-Bernardy (previous) (diff)

#3 follow-ups: @ocean90
10 years ago

Why only $locale.php? What about the language files?

#4 in reply to: ↑ 3 @swalkinshaw
10 years ago

Replying to ocean90:

Why only $locale.php? What about the language files?

It was only $locale.php before (see patch). This just allows it to be optionally loaded from a subdirectory (named after WP_LANG) as well.

#5 @nacin
10 years ago

We're trying to eliminate the need for $locale.php by absorbing their functionality into core. By the end of 2014 (I hope), no official language distribution will have them anymore. That's not to say we'd stop including them if the file exists, but I don't see a need to do this.

#6 in reply to: ↑ 3 @Denis-de-Bernardy
10 years ago

Replying to ocean90:

Why only $locale.php? What about the language files?

All of them, really. Not just locale.

#7 @SergeyBiryukov
10 years ago

  • Version changed from trunk to 3.8

#8 @chriscct7
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Per comment:5 closing as wontfix

Note: See TracTickets for help on using tickets.