WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] How can I change the text prompt in the Subscribe2 widget? (24 posts)

  1. Gui
    Member
    Posted 1 year ago #

    Hi,

    I would just need to remove "Enter Email: " from the widget, how can I do that?

    Thanks

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

  2. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Gui,

    If you are talking about changing the text inside the text box, there is an option coming in the next version (coming in the next 48 hours, I hope) to disable JavaScript in the form so that text is removed and the box is empty.

    If you want to change the text to something else the easiest way would be to use a translation file in WordPress, this would mean your alterations would persist after updates without needing to keep editing the code.

  3. RichardsGallery
    Member
    Posted 1 year ago #

    Hi

    I'm with Gui here. I'd like to change the text box text as well but as a beginner I don't understand how to go about using a translation file.

    If you could give some more info that would be great.

    Would it not be possible to simply include an edit box in the widget dashboard?

    Many thanks

  4. RichardsGallery
    Member
    Posted 1 year ago #

    Or, on reflection, could you shorten the default text to something like

    'Manage your subscription Profile here'

  5. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    I get a lot of people wanting to customise the plugin and change the phrases to meet their personal preferences. If I made all of the strings available in the Settings or Widget it would be very daunting to a first time user as there would literally be hundreds of options. I therefore follow the WordPress mantra of 'choices not options'.

    You can make edits to the plugin code to alter the wording but you would lose these changes every time you apply an upgrade which is why I suggest using a translation file instead. This is covered in the WordPress Codex here:
    http://codex.wordpress.org/Translating_WordPress

  6. RichardsGallery
    Member
    Posted 1 year ago #

    I'm intrigued what the difference between a choice and an option is, but semantics aside, I'm still no wiser as to how to make the change.

    I've looked at the codex page and to a non-programmer it's no help whatsoever. I understand that repeating text changes after upgrades is not ideal but it is a whole lot more understandable than the page you linked me to.

    My frustration comes from my own lack of knowledge combined with the inability of the experts to communicate to mere mortals.

    I would suggest that if you get a lot of people asking how to change the text phrases, that would justify a more elegant solution.

  7. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    I can understand your frustrations, I used to be the same and somehow ended up developing this plugin!

    The difference between a choice and an option is a 'choice' is a decision made in the code, an option is a list of possibilities presented to the user. If you present options for all eventualities then the code can rapidly become overwhelming to the most determined of users.

    All that aside though, let's see if I can help a little more on the translation side of things. WordPress and many plugins employ a system for allowing the user presented strings to be 'translated'. Now this can mean into an entirely different language but it can also be more subtle - for example changing from US English to British English (So color compared to colour for example).

    You can use this same system to localise or translate strings in code to your preferred wording.

    First you need 2 things, one is a way of translating and the second is the template file to translate. The first would be something like the excellent and free POEdit but other options are discussed in the WordPress codex page I linked above.

    The template file you need for Subscribe2 is available on your own server but also here:
    http://plugins.svn.wordpress.org/subscribe2/tags/8.8/subscribe2.pot

    Download this file and load it into your chosen translator program. Change the strings you want to alter into your own wording and then save to a PO file (that a person readable file). The last step is then to create a machine readable (or MO) file and load that onto your server into either the plugin directory or wp-includes/languages/.

    WordPress may also need configured to look for those files but adding a dfine to your wp-confing.php file, for example like this which uses the French language code. Any lines you haven't translated will remain at the defaults.
    define ('WPLANG', 'fr_FR');

  8. RichardsGallery
    Member
    Posted 1 year ago #

    Many thanks for your patient and helpful answer.

    I'll follow your advice and give it a try but can't promise not to choose the option of asking another basic question..

  9. RichardsGallery
    Member
    Posted 1 year ago #

    Hi there

    Well I've had a go at most of your instructions but I'm a bit unclear where to upload my new MO file which I have called RDsubscribe2.mo (RD are my initials).

    You say 'The last step is then to create a machine readable (or MO) file and load that onto your server into either the plugin directory or wp-includes/languages/.' How do I choose?

    Also, you say WP may need to be configured with a define. How will I know if it does?
    And what exactly is the line I should add? [ define ('?', '?')]

    Thanks in anticipation.

  10. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    It's probably better to upload to 'wp-includes/languages/' as that won't be affected by updates.

    You should name the file 'subscribe2-rd_RD.mo' and then in the wp-config.php file use this:

    define ('WPLANG', 'rd_RD');

  11. RichardsGallery
    Member
    Posted 1 year ago #

    Thanks for your prompt reply.

    I can't see a folder called 'wp-includes/languages/' so is it ok to create it manually on the server?

    And how do I edit the .php file? Do I download it, textedit it and then upload it again? Or is there a better way within WP?

  12. RichardsGallery
    Member
    Posted 1 year ago #

    Update

    When I did the POedit I opened the original file, then shortened the POT file source text line from 'You may manage your subscription options from your' to 'Manage your subscription in your'. (It's the ugly alliteration 'may manage' that bothers me but after today I'll live with it)

    When I tried to Save As to my new files I got an error saying "header field 'Project-id-Version' still has the initial default value" with the warning that the file was saved safely but could not be compiled into the MO format and used. Nonetheless it created an MO file.

    In desperation I thought I'd upload and try anyway.

    I created a folder 'wp-includes/languages/' in which I uploaded my subscribe2-rd_RD.mo file.

    I edited wp-config.php and included the define command as you suggested however when I tested my site it had not made any difference.

    So. I imagine you're as fed up with this as I am now. Although having spent a whole day trying to change 8 words and failed, I have now lost the will to live.

    You have been very patient with me but making such a trivial change in such a complicated way is nonsense. I started off being frustrated and cross but after all this time I am now merely suicidal.

  13. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    Don't despair. Think of this as a learning process instead of just focussing on the goal.

    Are you using caching on your site? You may need to clear that out in order to see any change. You may also need to clear your browser cache of your sites files.

    Also, it might be worth entering a Project id version in the header of the file and re-creating the mo file just to be sure it isn't that.

  14. RichardsGallery
    Member
    Posted 1 year ago #

    Once again, thanks for your patience.

    - I don't know if I'm using cacheing on my site and I don't know where to check.

    - I went back to POedit & re-did the edit. I changed the version and saved with no errors. I then re-uploaded the MO file into Languages but still no joy.

    - I emptied the cache on my browser (Safari) and refreshed the site but no joy.

    The site, by the way, is http://www.richardsevents.co.uk

  15. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    Hmm, try moving the 'languages/' you created from the wp-includes/ folder to the wp-content/ one within WordPress.

  16. RichardsGallery
    Member
    Posted 1 year ago #

    Sorry for the delay - real-life interrupted the fun.

    I moved the languages folder to wp-content, emptied the browser cache, refreshed the page and ... still not working.

    I also checked that I'd made the define edit correctly in wp-config.php. As far as I can see it's correct but I noticed there is also a define ('WPLANG', 'en_US'), can they co-exist ok?

  17. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    You have found the cause then :)

    You can't have two co-existing define statements for the same constant (in this case WPLANG), so you need to erase the en_US one if you aren't using it. Then you will hopefully see the result of the Subscribe2 translation file appear.

  18. RichardsGallery
    Member
    Posted 1 year ago #

    So please confirm the syntax for commenting out the US line and which folder you want me to place languages.

    Also, when I upload the new wp-config file - is the update live immediately, or do I have to refresh something or logout/log back in?

  19. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    You can just erase the US line or to comment is out precede it with //.

    Once that's done it should change immediately.

  20. RichardsGallery
    Member
    Posted 1 year ago #

    Hi there,

    Well here we are, day 3 on how to edit an 8 word phrase and I am still seeing the default phrase rather than my translated option.

    To recap

    I got no errors when I saved the translation file so I assume it's ok (filename - subscribe2-rd_RD.mo).

    Having read some comments in wp-config, I uploaded the MO file into wp-content/languages.

    I commented out an existing line "//* define ('WPLANG', 'en_US'); * //" and having tried "define ('WPLANG', 'rd_RD');" without success I also tried "define ('WPLANG', 'subscribe2-rd_RD');".

    All to no avail.

    As it's very topical, it seems to me we have two options; either I am fundamentally stupid and cannot carry out simple and straightforward tasks (which is quite possible) or option 2, it's something else.

  21. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    I tested here on my sites and it only seems to work from the wp-content/plugins/subscribe2/ folder or wp-content/plugins/subscribe2/languages/.

    It doesn't work if you put the file into wp-content/languages/ or /wp-includes/languages/.

    That prompted me to look at the core WordPress function and it would seem that this is programmed behaviour in the WordPress core function.

    My apologies for leading you down a blind alley in where to place the file.

  22. RichardsGallery
    Member
    Posted 1 year ago #

    No apology necessary. I read some comments within the wp-config.php file that also said to put the MO file into wp-content.

    Anyway, I've moved the languages folder to the plugins/subscribe2 path and still the !@£$%^&*(!! won't work.

    Can I confirm that the define command should have the file 'rd_RD' and not 'subscribe2-rd_RD' ?

  23. RichardsGallery
    Member
    Posted 1 year ago #

    I Lie! I refreshed the browser & joy of joys it works!!

    I'm somewhat lost for words (which is a first), but now we've got there and I'll be able to continue with real life, I can relate to what remains of my social circle the fun that can be had with running a blogging site.

    Thanks once again for your patience & support.

  24. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @RichardsGallery,

    LOL :)

    I just download your mo file from your site, edited my WPLANG setting and crashed my computer (it had been running for a month without a reboot and doing some hard work in that time).

    Once I rebooted and got everything back running again it worked and I was just on my way here to say how weird it was that it didn't work for you!

    I'm glad it's sorted in he end though :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.