Support » Plugin: Lana Downloads Manager » Multi Language (qTranslate-X)

  • Resolved tabular

    (@tabular)


    Hello there,

    First of all thank you for your lovely plugin.

    It worked like a charm. I only had one problem regarding multi language for which I use qTranslate-X.
    It worked on most of the fields of an item inside the download center.
    Unfortunately it didn’t work on the downloadable item itself.
    That is: File Manager -> File (Url)

    Is there a list of compatible plugins for lana downloads?

    best regards

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hello,

    thank you for your fast answer.

    In the following screenshots you can see that the plugin qTranslate X adds to every “translatable field” the option to change the language.

    https://ibb.co/Q85xWLj
    https://ibb.co/Vwby960

    You also can see that this allows to add different content depending on the language you chose.
    This is only possible for “translatable fields” which are marked with a blue stripe to the left of the field.
    As one can easily see, this stripe is missing on the file uploader and therefore qTranslateX does not add the translation option to the download field.

    I hope this helps.

    best regards

    Here you have some additional information.
    I checked out the github of qTranslate-X and they are advertising with the feature that you can make custom fields translatable:
    https://ibb.co/Bj1njpB

    Here you can see the settings of the plugin:
    https://ibb.co/2chW9Km

    I hope this helped.

    best regards

    Plugin Author Lana Codes

    (@lanacodes)

    Add Add this code in Settings > Languages > Integration > Custom Configuration:

    {"vendor":{"plugins/lana-downloads-manager":"1.0"},"admin-config":{"lana_download":{"pages":{"post.php":"","post-new.php":""},"anchors":{"lana-downloads-manager":{},"lana-downloads-manager-info":{}}}}}

    Thank you for your answer.
    Your solution does not work properly.
    It certainly adds a translation flag to the “File Manager” field but the field itself still is only able to contain one value.

    For example. If you upload a picture, change the language afterwards and download a different one, the later upload is set for all languages.

    But thank you for your solution.

    best regards

    Plugin Author Lana Codes

    (@lanacodes)

    Oh, I understand the problem because the file upload is Javascript and it does not work with the translate plugin.

    Unfortunately, this is much more difficult to solve.

    The simplest solution is if you do not use the file upload, you only provide the link to the file manually.

    I usually use WPML plugin, it provides better compatibility. Among the free ones is Polylang which may be compatible.

    Sadly it is a legacy project running for a high priority customer. We cannot change the plugins on the run.

    Is it possible to provide a file upload field for each language?

    best regards

    Plugin Author Lana Codes

    (@lanacodes)

    Works with this code:

    {"vendor":{"plugins/lana-downloads-manager":"1.1"},"admin-config":{"lana_download":{"pages":{"post.php":"","post-new.php":""},"anchors":{"lana-downloads-manager":{},"lana-downloads-manager-info":{}},"forms":{"post":{"fields":{"upload-file-url":{"jquery":"#upload-file-url"},"upload-file-id":{"jquery":"#upload-file-id"}}}}}}}

    But in this case the frontend interface does not work because the language delimited file URL does not work properly. So the download button doesn’t work.

    thank you very much for your answer!

    I will test the code tomorrow and give a response.

    best regards

    Plugin Author Lana Codes

    (@lanacodes)

    Can you give me feedback? Did the code work?

    Hello Lana Codes,

    The plugin is working for the backend side (wp-admin). One can save for all languages provided by qTranslate-X.
    But we still have following Problem:

    
        $meta = get_post_meta($download->ID);
        $url = $meta['lana_download_file_url'][0];
        $fileid = $meta['lana_download_file_id'][0];
    

    When trying to get the url or the file_id we get the untraslated string that contains all languages.For Example: [:en]InEngish[:de]InDeutsch[:]
    I found the filter named “get_post_metadata” which is the function “lana_downloads_manager_qtranslate_filter_postmeta” added in the lana-downloads-manager-qtranslate plugin. But I am not sure if thats the right way to get the job done.

    Appreciate your help.

    best regards

    Plugin Author Lana Codes

    (@lanacodes)

    I was looking at this solution from the qTranslate X official website.

    Yes, meta is basically saved in two languages when the plugin is enabled. You then need to use the qTranslate X filter function to separate the two languages metadata.

    These functions are for this purpose:

    qtranxf_filter_postmeta();
    qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage();

    There may be other solutions, but I only found this solution.

    Thanks for the answer. I will test the solution now and write you a message if it worked.

    The functions you mentioned worked well to get the translated version for fields like
    lana_download_file_url.
    But I am still failing to access the real value of
    lana_download_file_id.

    I get the id “0” and cannot access the file through
    get_attached_file.

    • This reply was modified 10 months, 1 week ago by tabular.
    • This reply was modified 10 months, 1 week ago by tabular.
    Plugin Author Lana Codes

    (@lanacodes)

    Yes, I think I understand the problem.

    lana_download_file_id

    The ID field is generated by a JS code. For this to work, I would need to rewrite the JS section, which would be a big job, I don’t know how to do it, I don’t know how, I didn’t find any documentation about it.

    So only the URL field will work.

    Later, if I have more free time, I will try to find a solution.

    thank you very much. Just for clarification:

    I invoke get_attached_file to work with following functions:

    size_format
    filesize
    wp_check_filetype
    
    • This reply was modified 10 months, 1 week ago by tabular.
Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Multi Language (qTranslate-X)’ is closed to new replies.