Discussion:
How to download multiple language packs via the API
Nikola Nikolov
2014-01-27 16:11:08 UTC
Permalink
Is it possible yet(or is it coming in 3.9) to automatically download
language files for WP, plugins, themes?

If so, is it possible via filters/action hooks to ask WordPress to download
the language files for multiple languages, instead of just what the
currently active language is?

I'm asking this, because I resumed work on my multilingual plugin. In it
I've used a modified piece of code from qTranslate that would look for
translation files and download them from the WordPress.org repo.
Since I don't really like how it's written, and because of the fact that
this is/will be in core anyway, I don't see why to reinvent the wheel.

Best Regards,
Nikola Nikolov
Andrew Nacin
2014-01-27 16:14:49 UTC
Permalink
Hi Nikola,

Language packs only support a limited number of plugins and themes (more
happening here soon, though), but yes, these filters are in place. See
the plugins_update_check_locales and themes_update_check_locales filters in
wp-includes/update.php.

Nacin
Post by Nikola Nikolov
Is it possible yet(or is it coming in 3.9) to automatically download
language files for WP, plugins, themes?
If so, is it possible via filters/action hooks to ask WordPress to download
the language files for multiple languages, instead of just what the
currently active language is?
I'm asking this, because I resumed work on my multilingual plugin. In it
I've used a modified piece of code from qTranslate that would look for
translation files and download them from the WordPress.org repo.
Since I don't really like how it's written, and because of the fact that
this is/will be in core anyway, I don't see why to reinvent the wheel.
Best Regards,
Nikola Nikolov
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Nikola Nikolov
2014-01-27 16:47:36 UTC
Permalink
Well, the version of my code currently only downloads WordPress .mo files
anyway, so actually using the filters would add support for any plugins and
themes that get added :)
Post by Andrew Nacin
Hi Nikola,
Language packs only support a limited number of plugins and themes (more
happening here soon, though), but yes, these filters are in place. See
the plugins_update_check_locales and themes_update_check_locales filters in
wp-includes/update.php.
Nacin
Post by Nikola Nikolov
Is it possible yet(or is it coming in 3.9) to automatically download
language files for WP, plugins, themes?
If so, is it possible via filters/action hooks to ask WordPress to
download
Post by Nikola Nikolov
the language files for multiple languages, instead of just what the
currently active language is?
I'm asking this, because I resumed work on my multilingual plugin. In it
I've used a modified piece of code from qTranslate that would look for
translation files and download them from the WordPress.org repo.
Since I don't really like how it's written, and because of the fact that
this is/will be in core anyway, I don't see why to reinvent the wheel.
Best Regards,
Nikola Nikolov
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Nikola Nikolov
2014-01-27 18:08:04 UTC
Permalink
Hmmm - what about core translation files? I looked in
/wp-includes/update.php, /wp-admin/includes/update-core.php,
/wp-admin/includes/class-wp-upgrader.php, /wp-admin/update-core.php but
couldn't find any filters. It seems like the locale for core files is only
used in find_core_update() and that doesn't have any filters.

If it's currently not part of the design, do you have any ideas on how to
use the WordPress.org API in order to check for updated versions of the
translation files and download them?
Post by Nikola Nikolov
Well, the version of my code currently only downloads WordPress .mo files
anyway, so actually using the filters would add support for any plugins and
themes that get added :)
Post by Andrew Nacin
Hi Nikola,
Language packs only support a limited number of plugins and themes (more
happening here soon, though), but yes, these filters are in place. See
the plugins_update_check_locales and themes_update_check_locales filters in
wp-includes/update.php.
Nacin
Post by Nikola Nikolov
Is it possible yet(or is it coming in 3.9) to automatically download
language files for WP, plugins, themes?
If so, is it possible via filters/action hooks to ask WordPress to
download
Post by Nikola Nikolov
the language files for multiple languages, instead of just what the
currently active language is?
I'm asking this, because I resumed work on my multilingual plugin. In it
I've used a modified piece of code from qTranslate that would look for
translation files and download them from the WordPress.org repo.
Since I don't really like how it's written, and because of the fact that
this is/will be in core anyway, I don't see why to reinvent the wheel.
Best Regards,
Nikola Nikolov
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Nikola Nikolov
2014-01-29 11:17:25 UTC
Permalink
Sorry for bumping that, but does no one have any idea if it's possible to
use the API to download core language packs for multiple languages? If you
look at my previous email you'd see where I looked for any clues about
that, but couldn't find any.

If that's not possible, is there a way to use the WordPress.org API in a
way that would give me the URL's for core language packs, because right now
I'm basically trying 8 different URL's at
svn.automattic.com/wordpress-i18n/( which I don't even know if it's
the right place to look for the language
packs ) in order to find a matching language pack. Actually I'm trying 40
URL's per language - since I have 8 base URL's and then I have 5 language
packs that I'm trying to find( {$locale}.mo, admin-network-{$locale}.mo,
continents-cities-{$locale}.mo, ms-{$locale}.mo, admin-{$locale}.mo ) - and
that is extremely inefficient as you can guess.

Thanks,
Nikola
Post by Nikola Nikolov
Hmmm - what about core translation files? I looked in
/wp-includes/update.php, /wp-admin/includes/update-core.php,
/wp-admin/includes/class-wp-upgrader.php, /wp-admin/update-core.php but
couldn't find any filters. It seems like the locale for core files is only
used in find_core_update() and that doesn't have any filters.
If it's currently not part of the design, do you have any ideas on how to
use the WordPress.org API in order to check for updated versions of the
translation files and download them?
Post by Nikola Nikolov
Well, the version of my code currently only downloads WordPress .mo files
anyway, so actually using the filters would add support for any plugins and
themes that get added :)
Post by Andrew Nacin
Hi Nikola,
Language packs only support a limited number of plugins and themes (more
happening here soon, though), but yes, these filters are in place. See
the plugins_update_check_locales and themes_update_check_locales filters in
wp-includes/update.php.
Nacin
Post by Nikola Nikolov
Is it possible yet(or is it coming in 3.9) to automatically download
language files for WP, plugins, themes?
If so, is it possible via filters/action hooks to ask WordPress to
download
Post by Nikola Nikolov
the language files for multiple languages, instead of just what the
currently active language is?
I'm asking this, because I resumed work on my multilingual plugin. In
it
Post by Nikola Nikolov
I've used a modified piece of code from qTranslate that would look for
translation files and download them from the WordPress.org repo.
Since I don't really like how it's written, and because of the fact
that
Post by Nikola Nikolov
this is/will be in core anyway, I don't see why to reinvent the wheel.
Best Regards,
Nikola Nikolov
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...