• Resolved andany

    (@andany)


    First of all, I want to praise the plugin. Compared to some of the well-known loyalty plugins, this plugin is “Formula1! It has absolutely no impact on the speed of the page and it doesn’t overload the database. It loads quickly, the free version has countless functions that are very easy and quick to set up. You wouldn’t believe that such a thing exists. I think many would uninstall their premium plugins from other developers if they knew how much better this plugin is. Well, since it’s already excellent as a free plugin, I assume it’s perfect in the pro version. But I have a problem related to the German language and unfortunately it can’t be solved with a translation. Here’s what it’s about. I need one point and not just points, unfortunately one point doesn’t exist in this plugin. I don’t know if I can put a picture here to make it clearer what I mean. I can’t write one point and the next problem is nouns, i.e. in sentences like “spend more to get … additional…” In German, nouns are written in uppercase letters and here the word “points” is in lowercase letters. With the help of a css snippet I managed to solve the problem with “one point” but I can’t solve the second problem and I don’t want to have a semi-literate German language.
    I tried with a js snippet and the word points jumps to uppercase for a moment and then back to lowercase again. Can you help me? Kind Regards from Germany

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Elliot Sowersby / RelyWP

    (@elliotvs)

    Thanks for the kind words @andany

    Would much appreciated if you could share this awesome feedback as a review here: https://ww.wp.xz.cn/support/plugin/simple-points-and-rewards/reviews/#new-post 🙂

    Regarding your issue could you share the exact current string/phrase that is incorrect, and what it should look like? Then I can take a look into fixing it in the next update!

    Thread Starter andany

    (@andany)

    I’ll show you what I changed, then you’ll know what I meant. To solve the first problem, I enabled a PHP code snippet. As I said, I need not only “Points” I need “Point” too to display. This is snippet which solves that. This is the snippet that solved the first problem.

    add_filter( 'spar_formatted_points_message', 'custom_spar_singular_and_space_fix', 99, 3 );

    function custom_spar_singular_and_space_fix( $message, $template, $points ) {
    // 1. Correct singular
    if ( 1 === (int) $points ) {
    $message = str_ireplace( array('Punkte', 'Points'), array('Punkt', 'Point'), $message );
    }

    // 2. Force a space before the link/letter
    // Search for the number and add a non-breakable space after it.
    $message = preg_replace('/(\d+)\s*/', '$1 ', $message);

    // 3. Price repair (prevents 0.01)
    $message = str_replace(' ,', ',', $message);

    return ucfirst( trim($message) );
    }

    I only need the first command, but it had to be modified by the second and third commands so that it looks like on pictures in the first post.

    Second problem – To correctly display messages in the cart such as:

    You will earn %1$d %2$s from this order
    You earned %1$d %2$s from this order!

    I changed all strtolower( $points_label ) to ucfirst( $points_label ) in cart-checkout.php. This isn’t the best solution due to updates, but I have no other choice. If I solve this with a code snippet, the letters are jumping while the AJAX loads. The first image from the first post is incorrect, it’s from the single product page and can be changed using points_label and points_label_lower.
    The problem is with pre-existing sentences which explicitly require lowercase in the plugin files.As I already mentioned, this is a great loyalty points plugin, but it would need some adjustments for the German language. For example, if someone in Croatia wanted to use this plugin, they would have massive difficulties with the translation, since they have things like “1 bod,” “2 boda,” “10 bodova,” and they could only use “bodova” translated from English.I hope you now understand what I mean, and that’s why the topic title is “Translation problem”.

    Plugin Author Elliot Sowersby / RelyWP

    (@elliotvs)

    Thanks for the details. I am looking to implement a fix for this in the next update!

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

You must be logged in to reply to this topic.