WordPress.org

Ready to get started?Download WordPress

Forums

ReciPress
localization (28 posts)

  1. tatamata
    Member
    Posted 2 years ago #

    how can i translate 1.7. could not find example file. please advise.
    thanks for the great plugin.

    http://wordpress.org/extend/plugins/recipress/

    http://wordpress.org/extend/themes/recipress/

  2. keesiemeijer
    moderator
    Posted 2 years ago #

    If recipress is translate ready you can use this plugin to translate it: http://wordpress.org/extend/plugins/codestyling-localization/
    It can scan recipress for all translatable strings and create the necessary .po and .mo files.

    Use the instructions in this tutorial on how to use the plugin.

  3. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, I've heard that is a great plugin to use. Here's another tutorial about translating WordPress themes and plugins. http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/

    Be sure to share your translation with me so that it can added to the official plugin releases. Thanks!

  4. keesiemeijer
    moderator
    Posted 2 years ago #

    @Tammy Hart

    Do you have a .pot (or .po) file for your plugin that translators can use?

  5. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

  6. tatamata
    Member
    Posted 2 years ago #

    off course i will share the translation. could not find the po file in the distribution package :( so i downloaded it from svn. thanks

  7. MacItaly
    Member
    Posted 2 years ago #

    Hi Tammy,
    I translated ReciPress 1.7 in italian, using PoEdit, it need or there is already an italian translation?

  8. MacItaly
    Member
    Posted 2 years ago #

    Hi Tammy,
    seems that ReciPress doesn't recognize the new language.
    Files are recipress-it_IT.po and .mo in lang folder.
    I tried de/reactivating and reinstalling plugin too but without success.
    Any idea?

  9. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    I'm honestly completely new to localization. I had followed a tutorial and thought it was set up correctly but perhaps not. I would love any insight that you could offer. Does WordPress have to be set to that language in order for a plugin to try to use it, or is there a way it can be tested on an English install? Sadly, English is my only language.

  10. MacItaly
    Member
    Posted 2 years ago #

    I'm sorry Tammy but I cannot help you on this, as I'm not a coder but I'm sure that there are a lot, out there, that could help you.
    I only followed the normal procedure to translate, whit GETTEXT standard and, normally the extension recognizes the language file.
    ReciPress is a good plugin, I'm sure that somebody will help you on this.
    Thanks to share it

  11. keesiemeijer
    moderator
    Posted 2 years ago #

  12. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, in the main plugin file:

    // Localization
    add_action('after_theme_setup', 'recipress_plugin_setup');
    
    function recipress_plugin_setup() {
    	load_plugin_textdomain('recipress', false, RECIPRESS_DIR.'/lang/');
    }
  13. keesiemeijer
    moderator
    Posted 2 years ago #

    try it with the 'init' hook:

    // Localization
    add_action('init', 'recipress_plugin_setup');
    
    function recipress_plugin_setup() {
    	load_plugin_textdomain('recipress', false, RECIPRESS_DIR.'/lang/');
    }
  14. daveshine (David Decker)
    Member
    Posted 2 years ago #

    Hi there!
    Thanx for this wonderful plugin which we will add to some blogs - very well done ;-)

    I recognized the same behavior with the loading of the textdomain and find out that the loading call is wrapped in a function/hook which is wrong.

    There is no function/hook needed for that - just add the loading call at the beginning of the plugin code - to make sure everything after that is included in the display of the translations (also errors etc.).

    Just this line is neccessary not more:

    /** Load translations */
    load_plugin_textdomain( 'recipress', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );

    I changed this on my install and promptly all gets loaded in backend AND frontend! This is also regular WordPress standard.

    You can also add these two lines to the plugin header (in the main file):

    Text Domain: recipress
    Domain Path: /lang/

    This will make the plugin header/description also translateable.

    Thanx for that!

    I have it completely translated into German already and will post the link here too!

    Thanx again for the awesome work with the plugin!

    -Dave from Germany :)

  15. daveshine (David Decker)
    Member
    Posted 2 years ago #

    ...here are my German translations for download, which you can include in the plugin package if you want:

    download page: http://ddwb.me/5s
    direct URL for the zip: http://ddwb.me/5t

    Thanx, Dave :)

  16. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    Awesome! Thanks Dave!

  17. daveshine (David Decker)
    Member
    Posted 2 years ago #

    ...once again:
    The plugins get loaded before the themes so the hook "after_setup_theme" is too late because then we couldn't have translations in backend or frontend.

    For my plugins I always add the loading call in this order:
    - plugin header
    - then some constants (directories etc.)
    - then loading of textdomain

    -> This way also error messages - if I ever define one for wp_die or so - will also appear translated then.
    (see my profile for some plugin examples: http://profiles.wordpress.org/users/daveshine/ )

    Some plugin authors wrap the loading call into functions some not it's 50/50 but loading on a hook is not required or recommended...

    I've translated about 100 plugins and themes in the last months and gained lots of experience in this area so far... :)

    Thanx, Dave :)

  18. keesiemeijer
    moderator
    Posted 2 years ago #

    @daveshine

    and find out that the loading call is wrapped in a function/hook which is wrong.

    Why is this wrong? Most plugins call their text domain this way.

    it's 50/50 but loading on a hook is not required or recommended...

    So when do you load the plugin text domain, if not in a hook (init) which is recommended by the codex?

    http://codex.wordpress.org/Function_Reference/load_plugin_textdomain

    http://codex.wordpress.org/I18n_for_WordPress_Developers#Choosing_and_loading_a_domain

    http://codex.wordpress.org/Writing_a_Plugin#Internationalizing_Your_Plugin

  19. daveshine (David Decker)
    Member
    Posted 2 years ago #

    @keesiemeijer:
    I add it directly as it get's loaded when WP loads all plugins.

    It will work directly below the plugin header (main file), see this example from me here: http://plugins.svn.wordpress.org/bbpress-admin-bar-addition/trunk/bbpress-admin-bar-addition.php
    (I could also wrap this in a function - but it also works that way absolutely!)

    You can also add it within a function/method if you have a init function or a base class - see this example from Mark Jaquith: http://plugins.svn.wordpress.org/page-links-to/trunk/page-links-to.php

    Loading in a hook may work if the hook is fired very early! You may try this... I experienced in a lot of cases (especially plugins) that the loading_call came to late and so some strings get not displayed (error messages etc.).

    I hope this helps a bit.
    -Dave :)

  20. daveshine (David Decker)
    Member
    Posted 2 years ago #

    I just saw the codex so they hook it in "init" which is the general plugin loading hook so it gets loaded very early. You may use this and should work too! (Above I meant the theme setup hook etc. which is not recommended...)

  21. keesiemeijer
    moderator
    Posted 2 years ago #

    @daveshine (David Decker)

    What works works. I've made many plugins and never had any problems loading the text domain on the init hook (100/100). And saying it's not recommended is just not true.

    [edit] Sorry, too late I didn't see your last post

  22. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    Hey guys,

    I've been sick this week, so sorry for the delays.

    I just released 1.8 which includes a fix for loading the text domain. I also just launched ReciPress.com!

  23. Cerealfreak
    Member
    Posted 2 years ago #

    @Tammy

    I've updated to 1.8, but my it_IT stills fail to load. Any clue for that?

    By the way, my italian translation file is quite completed, could it be of interest as italian translation for your plugin package?

    tnx in advance for help,
    gabriele - http://www.cookspot.it

  24. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    I just released what I hope will be the final fix to this issue.

    I'd love to include your Italian translation in the next release. You can submit it at recipress.com/contact

  25. MacItaly
    Member
    Posted 2 years ago #

    Hi Tammy,
    RP 1.9.1 solve the problem with translation that now works, many tanks :)
    Anyway still there are some minor issue:

    1) string "Instruction Image Size" in settings is not translatable
    2) image sizes are still in english (the default language is italian)
    3) name of categories like Ingredients are created from start, so are in english but this is not a bug and, in any case, impossible to solve without a translated query, so don't mind, was only FYI

    Thanks again a lot for this plugin, I'll look for pro version

    Marco

  26. MacItaly
    Member
    Posted 2 years ago #

    Sorry, there is another string untranslated:

    in post, inserting a recipe, belove Ingredients fields there is:

    "Click the plus icon to add another ingredient. Manage Ingedients"
    that still remain in english.The rest seems fine.

    Thanks

    Marco

  27. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    You may need to refresh your translation since all the strings related to the new option are new. They are all translatable. Here is the code used to define them:

    array(
    	'label'	=> __('Instruction Image Size', 'recipress'),
    	'id' 	=> 'insruction_image_size',
    	'type' 	=> 'radio',
    	'options'=> array(
    		'thumbnail'	=> array(
    			'label'	=> __('Thumbnail', 'recipress'),
    			'value'	=> 'thumbnail'
    		),
    		'medium'	=> array(
    			'label'	=> __('Medium', 'recipress'),
    			'value'	=> 'medium'
    		),
    		'large'	=> array(
    			'label'	=> __('Large', 'recipress'),
    			'value'	=> 'large',
    			'default'=> true
    		),
    		'full'	=> array(
    			'label'	=> __('Full', 'recipress'),
    			'value'	=> 'full'
    		)
    	)
    )
  28. MacItaly
    Member
    Posted 2 years ago #

    You're right Tammy,
    I translated the RP 1.8 and used that one :)
    Thanks

    Marco

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags