I want to speak Spotlish
-
Hello all…
I am making a site called Spots Kenya and i am going to use the buddy press functions for the main social interaction part. Its a location orientated site that is all the \”top Spots\” in Kenya
In a brief nut shell i want to customise the names of the different things on my site.
Groups >> Spots
Group >> Spot
Members >> Spotters
Member >> Spotter
Burtadsit came up with a great Idea of using the translating functions to change these words because which in essence it is just making up a new language \”Spotlish\”
So i would like some guidence from someone FAMILIAR WITH TRANLATING to different languages.
– maybe a tutorial on how to do this for buddypress
– or the software needed
-
Update…
I have found this forum post… https://buddypress.org/forums/topic.php?id=171
And i now know that i have to buddypress.pot file.
What is the quickest and easiest editor for this? I have tried poedit but it doesnt like .pot ?? and it doesnt have a find and replace function??
Then once i have edited my buddypress.pot how do i impliment this??
UPDATE
I ahve managed to use poedit and i have started translating… I am going to do it on my flight tonight but between now it would be good to know how to impliment the .mo
basically i have spotlish.mo and i want to impliment it as a language…
Get the latest trunk and add this to your wp-config.php:
define( \'BP_GROUPS_SLUG\', \'spots\' );
define( \'BP_MEMBERS_SLUG\', \'spotters\' );Then just edit the other names in the actual template files, there is nothing wrong with that. The template is meant to be edited.
Q1) Latest Buddypress Trunk or MU Trunk … I assume buddypress… i have it running of the latest buddypress svn ?
Q2) where do i put these in my wp-config.php [spotskenya/wp-config.php]
define( ‘BP_GROUPS_SLUG’, ‘spots’ );
define( ‘BP_MEMBERS_SLUG’, ‘spotters’ );
?
Q3) “Then just edit the other names in the actual template files, there is nothing wrong with that. The template is meant to be edited. “
what is the template files? are they the core things in [spotskenya/wp-content/mu-plugins/] or in the theme????
wont this take ages and be harder to do than the language thing??
Sorry for all the basic simple questions
BuddyPress trunk, make sure you update again.
Put them anywhere in wp-config.php above the “stop editing” part.
No, just the template files in the /themes/ or /bp-themes/ directories.
It should take no time at all to edit the template files and add those two lines. It’s only a suggestion though, if you want to translate that is fine too.
i cant seem to edit my wp-config.php [spotskenya/wp-config.php] it says that i dont have permisions and even on the server side under cpannel it doesnt let me edit it i ahve tried setting permissions of it but they just revert back to 644 each time… its really strange and rather frustrating as i cant impliment the
define( ‘BP_GROUPS_SLUG’, ‘spots’ );
define( ‘BP_MEMBERS_SLUG’, ‘spotters’ );
is this something i can fix or will i have to contact my server people??
You can also try adding a file called ‘bp-custom.php’ into /mu-plugins/ and add those two lines there.
its all good… i have sorted it by creating a duplicate wp-config file then deleting the orriginal then renaming duplicate.. ….
I am working on getting the theme intergrated.
The reason I suggested the translation route is that modifying the theme causes people to hesitate when upgrading. They don’t want to lose any custom they have. If I’m operating off a working copy of the svn trunk I can take my chances on an svn merge going ok. That it will skip my custom. However if my upgrade process is to replace the old code with the new code, just upload to the server, then I’m less likely to upgrade bp.
If it’s possible to achieve a solution without touching *any* code, I’m all for it.
Here is how I did a custom translation to replace slugs and labels. I’m replacing my language name with spots so you can see how it would work for you.
1. First I opened the POT file, copied it to a .po version, and then made the changes I wanted in a text editor (most with search and replace, but also had to do some new lines by hand).
2. I uploaded the .po file to my web server, and ran this from a command line:
msgfmt -o buddypress-spots.mo buddypress-spots.po
3. In my bp-custom file (wp-content/mu-plugins/bp-custom.php) I added a language definition:
define( 'BPLANG', 'spots' );
if ( file_exists( ABSPATH . MUPLUGINDIR . '/bp-languages/buddypress-' . BPLANG . '.mo' ) ) {
load_textdomain( 'buddypress', ABSPATH . MUPLUGINDIR . '/bp-languages/buddypress-' . BPLANG . '.mo' );
}
4. Then I went into wp-content/mu-plugins/bp-languages and added the spots.mo file there.
This solution is better (in my opinion) than using the define (‘WPLANG’, ”); in your wp-config.php file, and won’t break when you upgrade BuddyPress.
@Lance Willett
Thanks a few questions if you dont mind… my replies below your pont
********
1. First I opened the POT file, copied it to a .po version, and then made the changes I wanted in a text editor (most with search and replace, but also had to do some new lines by hand).
*******
Yes i have started doing this with poedit and i have now looked at doing this with text editor.. so once i have changed all groups to spots etc ill be ready with the .po and .mo file….
**********
2. I uploaded the .po file to my web server, and ran this from a command line:
*********
where do i upload the .po file to??
msgfmt -o buddypress-spots.mo buddypress-spots.po
**********
What directory to i run this command in.. in the bas root one of the site or in /wp-content/
or /wp-content/mu-plugins/
???
what does this command do exactely
******
4. Then I went into wp-content/mu-plugins/bp-languages and added the spots.mo file there.
********
did you mean.. “and added the buddypress-spots.mo file there…”
___________________
I too think that this is better long term as if each time i update it will nock out my changed files…
QUESTION the things i have defined…
define( ‘BP_GROUPS_SLUG’, ‘spots’ );
define( ‘BP_MEMBERS_SLUG’, ‘spotters’ );
i have already set up in wp-config.php will this clash with what you have said to doo..
thanks so much
Ha! I knew it was a good idea. I do have one every once in awhile.
Any side effects of this we should know about Lance? What do you have to do different now that you didn’t before you had the faux translation?
No side effects that I know of, though our setup is still \”young\” (only been live for just over a month) so I don\’t know the long-term implications yet.
One thing I will mention, though — if you site has been live for a while you\’ll have to do some SQL cleanup in the database to rename things that have been cached (like user activity). For example:
UPDATE wp_bp_activity_sitewide SET content = replace(content,\' wire:\',\' wall:\');
What do you have to do different now that you didn\’t before you had the faux translation?
Actually, the biggest difference is a positive one: instead of hand-changing all the instances of \”Wire\” in the plugin and theme files we keep that in the language file instead. Since the language file (and the bp-custom file) aren\’t in the BuddyPress SVN repo they will never get overwritten when we upgrade.
cool cool i have got it all working now.. thanks Lance
Great — glad to hear it. Sorry to have missed your previous questions.
where do i upload the .po file to??
Anywhere on the server, it doesn’t matter.
what does this command do exactely
It takes your PO file and creates the MO for you.
did you mean.. â€and added the buddypress-spots.mo file there…â€
Yes.
i have already set up in wp-config.php will this clash with what you have said to doo..
Hmmm… that I don’t know. I don’t use those configuration settings, myself. I would suggest commenting them out and testing your site. If the language file changes are still working, go ahead and delete those lines from your wp-config file.
Overall the language file is a better long-term solution since you can make changes for other labels there as well if they come up in future versions, whereas those custom definitions are only specific to a few labels.
now that its changed to plugins does the code in bp-custom change to this
<?php
define( ‘BPLANG’, ‘spots’ );
if ( file_exists( ABSPATH . PLUGINDIR . ‘buddypress/bp-languages/buddypress-‘ . BPLANG . ‘.mo’ ) ) {
load_textdomain( ‘buddypress’, ABSPATH . PLUGINDIR . ‘buddypress/bp-languages/buddypress-‘ . BPLANG . ‘.mo’ );
}
?>
FIXED this worked for me..
<?php
define( ‘BPLANG’, ‘spots’ );
if ( file_exists( ABSPATH . PLUGINDIR . ‘/buddypress/bp-languages/buddypress-‘ . BPLANG . ‘.mo’ ) ) {
load_textdomain( ‘buddypress’, ABSPATH . PLUGINDIR . ‘/buddypress/bp-languages/buddypress-‘ . BPLANG . ‘.mo’ );
}
?>
You should be using the new BP_PLUGIN_DIR constant, which was introduced in revision 1303 for moving to MU 2.7.1 support.
Something like:
define( 'BPLANG', 'spots' );
if ( file_exists( BP_PLUGIN_DIR . '/bp-languages/buddypress-' . BPLANG . '.mo' ) ) {
load_textdomain( 'buddypress', BP_PLUGIN_DIR . '/bp-languages/buddypress-' . BPLANG . '.mo' );
}Are there a revised set of steps to this?
On the latest trunk, I don’t have: wp-content/mu-plugins/bp-custom.php
@Seobrien — good point.
I will post some better/updated directions soon…
For now, the pertinent change to know about is switch from “wp-content/mu-plugins” to the new location for plugins, which is “wp-content/plugins/buddypress”. The “bp-custom.php” file goes inside that folder, and the languages files go inside “wp-content/plugins/buddypress/bp-languages”.
I am doing much the same, but I am not sure if I should replace all instances of ‘Wire’ to ‘Wall’ (in the .po file) many of them seem to be referencing existing php files. Won’t that break the installation?
-Ezra
Ezra,
When you are editing the language file (after copying the POT to a PO), you will see two lines for each entry: a msgid and a msgstr — the message id and the message string. For example:
msgid "Group Wire"
msgstr "Group Wall"The important thing is to only edit the message string, not anything else. The message id, as well as the lines above it that indicate which file and line the entry belongs to, are essential for the language translation to work and should not be touched.
Ezra, Seobrien, Timothy, and others interested in customizing labels and messages — I’ve posted a full instruction set with examples to the Codex: Customizing Labels, Messages, and URLs.
Having worked through the thread, my understanding is that this is the set of directions to follow in RC1 yet it failed to change anything:
1. Write in new language to msgstr within buddypress.pot and save as buddypress-spots.mo (wp-content/mu-plugins/bp-languages/buddypress-spots.mo)
msgid “Group Wire”
msgstr “Group CHANGED”
2. Create custom file bp-custom.php (wp-content/mu-plugins/bp-custom.php) as such:
<?php
define( ‘BPLANG’, ‘spots’ );
if ( file_exists( BP_PLUGIN_DIR . ‘/bp-languages/buddypress-‘ . BPLANG . ‘.mo’ ) ) {
load_textdomain( ‘buddypress’, BP_PLUGIN_DIR . ‘/bp-languages/buddypress-‘ . BPLANG . ‘.mo’ );
}
?>
What am I missing?
@Seobrien — wrong instructions, maybe? Follow my link: https://codex.buddypress.org/developer-docs/customizing-labels-messages-and-urls/.
There is no mention of “mu-plugins” in the page, and you have to make sure the “spots” part of the file name to match your own site’s nickname or label.
- The topic ‘I want to speak Spotlish’ is closed to new replies.