[buddypress-trac] [BuddyPress] #4857: Automatic download of translations from translate.wordpress.org

buddypress-trac noreply at wordpress.org
Fri May 24 03:33:55 UTC 2013


#4857: Automatic download of translations from translate.wordpress.org
-----------------------+-----------------------
 Reporter:  DJPaul     |       Owner:  DJPaul
     Type:  task       |      Status:  reopened
 Priority:  normal     |   Milestone:  1.8
Component:  i18n       |     Version:
 Severity:  normal     |  Resolution:
 Keywords:  has-patch  |
-----------------------+-----------------------

Comment (by SergeyBiryukov):

 Replying to [comment:20 nacin]:
 > MO files also do not have headers, which means we can't read headers
 from them (which we can with .po).

 Actually, they have.

 I've exported translations from !GlotPress as an .mo file and used this
 snippet to display the headers:
 {{{
 require( 'wp-load.php' );

 $mo = new MO();
 $mofile = WP_LANG_DIR . '/ru_RU.mo';
 if ( ! $mo->import_from_file( $mofile ) )
         return false;

 print_r( $mo->headers );
 }}}
 Output:
 {{{
 Array
 (
     [PO-Revision-Date] => 2013-05-24 03:08:52+0000
     [MIME-Version] => 1.0
     [Content-Type] => text/plain; charset=UTF-8
     [Content-Transfer-Encoding] => 8bit
     [Plural-Forms] => nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 :
 n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);
     [X-Generator] => GlotPress/0.1
     [Project-Id-Version] => 3.5.x
 )
 }}}
 Then I've exported translations as a .po file and verified that its
 headers were the same.

 .mo files can also be decompiled back to .po with msgunfmt utility. That
 said, I'd agree that .po files should be downloaded as well.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4857#comment:23>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list