Hello clavaque,
How do I translate my stripe form into another language ?
When I check the page, it is in English.
Is there any way to translate into another language?
Thank you!
Hello clavaque,
How do I translate my stripe form into another language ?
When I check the page, it is in English.
Is there any way to translate into another language?
Thank you!
Hi Robert,
See these articles:
Hi Cristián, thanks for the support.
Being able to perform the translation through the add_filter function.
Just still can’t translate that marked part.
do I change these sentences internally in the plugin?
thanks!
Hmm…
The “description and pricing details…” one is from the desc attribute in your shortcode, right? You can change it there.
I checked, and the Create Profile string should be translatable with what the Quick Translation article describes.
Could you show me the code you’re using for the translation?
Christian,
I’m not a developer, the code I’m using is this.
If you can adjust, thank you,
<?php
add_filter(
"gettext_with_context",
function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "First Name") {
$translated = "Primeiro Nome";
} elseif ($original === "Submit Form") {
$translated = "Enviar";
}
}
return $translated; // Return final translation.
},
10,
4
);
add_filter(
"gettext_with_context",
function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "Last Name") {
$translated = "Sobrenome";
} elseif ($original === "Email Address") {
$translated = "E-mail";
}
}
return $translated; // Return final translation.
},
10,
4
);
add_filter(
"gettext_with_context",
function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "Username -lowercase alphanumeric") {
$translated = "Nome de usuário -alfanumérico minúsculo";
} elseif ($original === "Billing Method") {
$translated = "Método de cobrança";
}
}
return $translated; // Return final translation.
},
10,
4
);
add_filter(
"gettext_with_context",
function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "Credit or debit card") {
$translated = "Cartão de crédito ou débito";
} elseif ($original === "Checkout Now") {
$translated = "Finalizar compra agora";
}
}
return $translated; // Return final translation.
},
10,
4
);
add_filter(
"gettext_with_context",
function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "Username (lowercase alphanumeric)") {
$translated = "Nome de Usuário (Alfanumerico)";
}
}
return $translated; // Return final translation.
},
10,
4
);
add_filter(
"gettext_with_context",
function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "Thank you. Your account has been approved") {
$translated = "Obrigada. Sua conta foi aprovada";
}
}
return $translated; // Return final translation.
},
10,
4
);
add_filter(
"gettext_with_context",
function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "You'll receive an email momentarily") {
$translated = "Você receberá um e-mail momentaneamente";
}
}
return $translated; // Return final translation.
},
10,
4
);
I use the code in a snippet in wordpress
Thanks
Thanks!
Well, you’re missing the translation for “Create Profile”, that’s why it’s not being changed. It’d be something like:
if ($original === "Create Profile") {
$translated = "Criar perfil";
}
Hmm… You have so many, and they don’t need to be each separate… You can probably do something like this (untested)
<?php
add_filter("gettext_with_context", function ($translated, $original, $context, $text_domain) {
if ($context === "s2member-front" && $text_domain === "s2member") {
if ($original === "First Name") {
$translated = "Primeiro Nome";
} elseif ($original === "Submit Form") {
$translated = "Enviar";
} elseif ($original === "Last Name") {
$translated = "Sobrenome";
} elseif ($original === "Email Address") {
$translated = "E-mail";
} elseif ($original === "Username -lowercase alphanumeric") {
$translated = "Nome de usuário -alfanumérico minúsculo";
} elseif ($original === "Billing Method") {
$translated = "Método de cobrança";
} elseif ($original === "Credit or debit card") {
$translated = "Cartão de crédito ou débito";
} elseif ($original === "Checkout Now") {
$translated = "Finalizar compra agora";
} elseif ($original === "Username (lowercase alphanumeric)") {
$translated = "Nome de Usuário (Alfanumerico)";
} elseif ($original === "Thank you. Your account has been approved") {
$translated = "Obrigada. Sua conta foi aprovada";
} elseif ($original === "You'll receive an email momentarily") {
$translated = "Você receberá um e-mail momentaneamente";
} elseif ($original === "Create Profile") {
$translated = "Criar perfil";
}
}
return $translated; // Return final translation.
}, 10, 4);
or perhaps…
<?php
add_filter('gettext_with_context', function ($translated, $original, $context, $text_domain) {
if ($context === 's2member-front' && $text_domain === 's2member') {
if ($original === 'First Name')
return 'Primeiro Nome';
if ($original === 'Submit Form')
return 'Enviar';
if ($original === 'Last Name')
return 'Sobrenome';
if ($original === 'Email Address')
return 'E-mail';
if ($original === 'Username -lowercase alphanumeric')
return 'Nome de usuário -alfanumérico minúsculo';
if ($original === 'Billing Method')
return 'Método de cobrança';
if ($original === 'Credit or debit card')
return 'Cartão de crédito ou débito';
if ($original === 'Checkout Now')
return 'Finalizar compra agora';
if ($original === 'Username (lowercase alphanumeric)')
return 'Nome de Usuário (Alfanumerico)';
if ($original === 'Thank you. Your account has been approved')
return 'Obrigada. Sua conta foi aprovada';
if ($original === "You'll receive an email momentarily")
return 'Você receberá um e-mail momentaneamente';
if ($original === 'Create Profile')
return 'Criar perfil';
}
return $translated; // Return final translation.
}, 10, 4);
Maybe that makes it simpler to work with.