WordPress.org

Support

Support » Plugins and Hacks » Trabslation of "Sorry, this file type is not permitted for security reasons"

Trabslation of "Sorry, this file type is not permitted for security reasons"

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Milan Petrovic

    @gdragon

    Yes, that is strange. Plugin gets this error from WP, so it should be translated. I will check.

    Great.
    Thanks.

    Hello again,

    I see that the problem still exists even after I updated everything.

    Thanks

    Plugin Author Milan Petrovic

    @gdragon

    Plugin is not doing anything with this, this must be translated in WP language file.

    @milan Petrovic actually the plugin have some control on this problem , as you see the sentence “Sorry, this file type is not permitted for security reasons” is added in admin.mo file , so It can’t be translated in the front-end of the site .

    I have a simple idea It can be improve your plugin l10n strategy , You can add a tricky text-domain to all WordPress l10n functions like __() , _e() … etc , and have some config option to load the translation from the WordPress or from plugin translation files .. Confuse ?!

    Let’s Talk By Code ..

    <?php
    
    define ( "LOAD_L10N_FROM_WP" , false ); 
    
    add_filter ( 'gettext' , "AW_get_translation" , 1 , 3 );
    
    function AW_get_translation ( $translation , $text, $domain ) {
    
        if ( $domain == "maybe-wp" ) {
    
            if ( LOAD_L10N_FROM_WP == false ) {
                 $translation = __( $text , "plugin-text-domain" );
            } else {
                 $translation = __( $text );
            }
    
        } // end if
    
        return $translation;
    
    } // end AW_get_translation()
    
    _e( "Hello World" , "maybe-wp" );
    
    ?>

    Note: I write my code on the fly ( No Testing ) so you can improve it or using other strategy , After all it just an idea 🙂

    Another way to write the code above :

    <?php
    
    define ( "LOAD_L10N_FROM_WP" , false ); 
    
    function AW_get_maybe_textdomain () {
       return ( !LOAD_L10N_FROM_WP ) ? "plugin-text-domain" : "";
    }
    
    _e( "Hello World" , AW_get_maybe_textdomain() );
    
    ?>
    Plugin Author Milan Petrovic

    @gdragon

    This is not good solution for one string. I will try to find some other way to solve this.

    This is not good solution for one string. I will try to find some other way to solve this.

    Sure Thing , It may be a very good solution if you rely on many WordPress translation strings , anyway you know what your plugin needs 🙂

    Started 2 months and it’s not resolved yet !

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Trabslation of "Sorry, this file type is not permitted for security reasons"’ is closed to new replies.