Would you like to show your Facebook feed in another language?
Facebook Feed shows several kinds of text. Some of it comes from Facebook, and some of it comes from the plugin.
This guide shows which text you can translate and where to change it. It also covers month names in dates, text before and after a date, and right-to-left languages.
Before you get started, make sure Facebook Feed is installed and activated on your WordPress site.
- Choosing the Language of Facebook Text
- Translating the Plugin’s Own Text
- Changing the Language of the Date
- Showing a Right-to-Left Language
- Frequently Asked Questions
Choosing the Language of Facebook Text
Two kinds of text come from Facebook. The first is the text of each post, which shows in the language it was written in. The second is the short description Facebook adds to some posts, such as “added a photo” or “shared a link”. The Localization setting controls the language of that second kind.
If you write posts in more than one language, the same setting also picks which language version of a post to show. To change it, follow these steps.
- First, go to Facebook Feed » Settings in your WordPress dashboard.
- Next, click the Feeds tab.
- Then, find the Localization box and choose a language from the list.
- Finally, save your changes.
Next, you can change the words the plugin itself adds to your feed.
Translating the Plugin’s Own Text
The rest of the text comes from the plugin itself. It includes words such as “See More”, “See Less”, “View on Facebook”, and “Share”. You change them in two places.
You can set the words in the links under each post, “View on Facebook” and “Share”, for one feed in the feed builder. To change them, follow these steps.
- First, go to Facebook Feed » All Feeds in your WordPress dashboard and open the feed you want to change.
- Next, click the Customize tab. Then click Posts.
- Then, click Edit Individual Elements. Next, click Post Action Links.
- Finally, type your own wording in the Customize Text box under each link, and click Save at the top of the builder.
The Translation tab sets the plugin text for all your feeds, such as “See More”, “See Less”, and the time words in dates. It also has rows for “View on Facebook” and “Share”. If a feed has its own wording in a Customize Text box, that feed uses its own wording instead. To change the text on this tab, follow these steps.
- First, go to Facebook Feed » Settings in your WordPress dashboard.
- Next, click the Translation tab.
- Then, type your wording in the Custom text/translation column, next to the original text.
- Finally, save your changes.
Now that the plugin text is set, you can look at how dates appear in another language.
Changing the Language of the Date
By default, the month and weekday names in a date follow the language of your WordPress site. That language is the Site Language setting, under Settings » General in your WordPress dashboard. When WordPress has a translation for that language, the names match the rest of your site with no extra setup.
The words in a date such as “2 days ago” are different. They come from the Translation tab described above. Each one has its own row, from seconds to years, plus a row for “ago”.
If your event dates need the months in a different language from your site, you can translate them with a short script, as shown below.
Translating Month Names with JavaScript
This also works when you want your own wording for the months. The script replaces each month name in the event dates with the text you give it.
- First, copy the script below. Then, replace each “Translated” value with your own word for that month.
- Next, add the script to your site with WPCode. Our custom JavaScript guide shows how.
<!-- Custom Facebook Feed JS -->
<script type="text/javascript">
function cff_custom_js($){
var $ = jQuery;
var months = { Jan: "Translated Jan", Feb: "Translated Feb", Mar: "Translated Mar", Apr: "Translated Apr", May: "Translated May", Jun: "Translated Jun", Jul: "Translated Jul", Aug: "Translated Aug", Sep: "Translated Sep", Oct: "Translated Oct", Nov: "Translated Nov", Dec: "Translated Dec" };
var pattern = new RegExp(Object.keys(months).join('|'), 'g');
$('.cff-start-date, .cff-end-date').not('.cff-months-translated').each(function(){
var $date = $(this).addClass('cff-months-translated');
$date.html($date.html().replace(pattern, function(matched){ return months[matched]; }));
});
}
cff_custom_js(jQuery);
</script>
The script changes the event dates in every feed on the pages where it loads. It marks each date once it has been changed, so it doesn’t run twice when a visitor clicks the Load More button. If your date format shows the full month names, change “Jan”, “Feb”, and the other names in the script to “January”, “February” and so on.
Adding Text Before or After a Date
In some languages, the word for “ago” belongs before the date and not after it. In French, “3 months ago” is “Il y a 3 mois”. If you translate “ago” to “Il y a”, the feed shows “3 mois Il y a”, which doesn’t read correctly. German has the same problem with “vor 2 Tagen”. To fix it, follow these steps.
- First, open your feed in the feed builder and click the Customize tab. Then click Posts.
- Next, click Edit Individual Elements. Then click Date.
- Then, turn on Add text before date and type your word or phrase in the box that appears, such as “Il y a” or “vor”. Next, click Save at the top of the builder.
- Finally, go to Facebook Feed » Settings, click the Translation tab and type a single space in the box for “ago”. This removes the word “ago” and leaves a blank space in its place. If the time words such as “months” and “days” are still in English, translate them in the same table. Then save your changes.
The same Date section also has an “Add text after date” option, in case your language needs a word after the date instead.
Showing a Right-to-Left Language
If your language reads from right to left, such as Arabic, you can flip the direction of the text in a feed. The CSS below also aligns the text to the right. To do this for a single feed, follow these steps.
- First, add a class to the shortcode of that feed on your page, as in
[custom-facebook-feed feed=1 class="right-to-left"]. The class can have any name you like, as long as the CSS in the next step uses the same name. This guide uses “right-to-left”. - Next, add the CSS
#cff.right-to-left p { direction: rtl; text-align: right; }to your site. Our custom CSS guide shows where to put it.
Only the feed with that class changes. Your other feeds keep their usual direction.
That’s it! You now know where to change each kind of text in your feed, how to translate month names, and how to show a right-to-left language. For more custom code you can copy, see our Facebook Feed custom snippets guide.
Frequently Asked Questions
Below, we’ve answered some of the most common questions about text and language in Facebook Feed.
Why are my posts not in my site’s language?
The text of a post comes from Facebook and shows in the language it was written in. If you post in more than one language, the Localization setting on the Feeds tab picks which one to show.
Where do I change “View on Facebook” and “Share”?
To do this, open your feed in the builder, click Customize, then Posts, then Edit Individual Elements, then Post Action Links. Each link has a Customize Text box. The Translation tab also has both words, and a feed uses them unless its Customize Text box has its own wording. See the Translating the Plugin’s Own Text section above.
Why do the months in my feed show in English?
Month names follow the Site Language under Settings, then General, in your WordPress dashboard. If that setting is English, the months are in English. To use a different language for the months in event dates, see the Translating Month Names with JavaScript section above.
Can I make a date read “vor 2 Tagen” or “Il y a 3 mois”?
Yes. To do this, use the Add text before date option in the Date section of your feed, and type a single space in the box for “ago” on the Translation tab. See the Adding Text Before or After a Date section above.