Forum Replies Created

Viewing 1 replies (of 1 total)
  • 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”.

Viewing 1 replies (of 1 total)