WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#1550 closed defect (bug) (wontfix)

Improve l10n stuff

Reported by: whimboo Owned by: whimboo
Milestone: Priority: normal
Severity: major Version: 1.5.2
Component: General Keywords:
Focuses: Cc:

Description

The use of dynamically switching locales in wordpress seems to be really impossible currently.

I improved the handling by changing a lot of the wp-l10n.php content. The biggest issues were the handling of the default domain. Why a locale 'default' is used by different functions? There are locale id's which should be used! Otherwise localization won't really work.

Further I added a function set_locale which allows to set a locale directly. It checks if %locale%.mo is already loaded. If not the file will be loaded and the locale is set immediately if loading was successful.

With the patch it's possible to activate another language by simply calling set_locale('%locale_id%'). This will offer a way to let the user select his prefered language with e.g. the help of a drowndown box.

Patch is upcoming.

Attachments (1)

1550.diff (2.3 KB) - added by whimboo 13 years ago.
Patch

Download all attachments as: .zip

Change History (4)

@whimboo
13 years ago

Patch

#1 @whimboo
13 years ago

  • Status changed from new to assigned

There are some issues left. First, no sticky bit is available to fetch the current locale during the next load of a page. Should a cookie be used for?

The additionally functions load_plugin_textdomain and load_theme_textdomain won't work when the locale was set before. Due to $l10n[$domain] still exists loading is aborted. That has to be changed so new entries will be appended to the hash.

#2 @runar
13 years ago

  • Severity changed from normal to major
  • Version changed from 1.6 to 1.5.2

Using Ubuntu Hoary, Apache2 I can't get latest Wordpress (1.5.2) to accept the nb_NO.mo file, nor does any other .mo file I've tested work.

I have localized the problem to the load_default_textdomain function in wp-includes/wp-l10n.php as that's the function complaining when replacing the wp-l10n.php with the same file from WP1.2.

No errors, no reportings, no log messages. Plain just doesn't work.

#3 @ryan
12 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

Locale and domain are different things.

Note: See TracTickets for help on using tickets.