Loco Translate think the source of my plugin language is English, but it is FR

[ad_1]

Plugin Author
Tim W

(@timwhitlock)

There is a workaround for using machine translation services with a non-english source. See the loco_api_providers filter.

I’m not familiar with your “@sourceLanguage” notation. Can you tell me more about this?

Related FAQ: Can I translate from a language other than English?

Hello Tim,

Well I can’t remember where I have seen that adding @sourceLanguage in the comments made for the settings of the plugin, it helps explaining what is the primary language of this plugin.
I was hopping that you used it to know what kind of source language is the text.
Anyway, I have tried your following trick :

function use_alternative_source_language( array $apis ){
foreach( $apis as $i => $api ){
$apis[$i]['src'] = 'fr';
}
return $apis;
}
add_filter('loco_api_providers','use_alternative_source_language',999,1);

And it works fine for the translation (meaning translator assume correctly that source language is French).

However, Loco Translate still write the mini “EN” tag when showing the source text in its interface ?

Plugin Author
Tim W

(@timwhitlock)

Yes, it will show as “English” (even if it isn’t) because I’m afraid en_US is the source language of WordPress. Writing source strings in French is fine, because the editor doesn’t care. It’s just text.

@sourceLanguage is doing nothing as far as I know. Perhaps some other plugin observes this.

My plugin has no mechanism to force a non-English source. There will be no change to that until WordPress provides its own mechanism. This seems quite unlikely, partly for the reasons documented in my FAQ.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer