• Resolved wptechnology

    (@wptechnology)


    Hello,
    I’m struggling with loco translate. I designed a wordpress plugin that contains a certain number of texts correctly placed between __().
    The plugin is well initialized with the following strings in the settings comments:

    * Domain Path: /languages
    * @sourceLanguage fr_FR

    However, when I go to Loco Translate, to translate the texts of my plugin, it considers that the source is “EN” and therefore I cannot launch an automatic translation into English since for it the texts are already in English.
    What is missing for it to understand that the original texts are in French?

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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?

    Thread Starter wptechnology

    (@wptechnology)

    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.

    Thread Starter wptechnology

    (@wptechnology)

    Very interesting, thanks for sharing. And thanks a lot for your speed.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Loco Translate think the source of my plugin language is English, but it is FR’ is closed to new replies.