Created
February 25, 2025 03:39
-
-
Save loorlab/bb75a0e2e3e97b59e6c482ce2c484261 to your computer and use it in GitHub Desktop.
Translate : WooCommerce Checkout Fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Force translate WooCommerce | |
add_filter('gettext', function($translated, $text, $domain) { | |
if ($domain === 'woocommerce') { | |
$translations = [ | |
'Billing details' => 'Detalles de facturación', | |
'First name' => 'Nombre', | |
'Last name' => 'Apellido', | |
'Company name' => 'Nombre de la empresa', | |
'Country / Region' => 'País / Región', | |
'Street address' => 'Dirección', | |
'Apartment, suite, unit, etc. (optional)' => 'Apartamento, suite, unidad, etc. (opcional)', | |
'Town / City' => 'Ciudad', | |
'State / County' => 'Estado / Provincia', | |
'Postcode / ZIP' => 'Código postal', | |
'Phone' => 'Teléfono', | |
'Email address' => 'Correo electrónico', | |
'Additional information' => 'Información adicional', | |
'Order notes (optional)' => 'Notas del pedido (opcional)', | |
'Your order' => 'Tu pedido', | |
'Place order' => 'Realizar pedido', | |
'Subtotal' => 'Subtotal', | |
'Shipping' => 'Envío', | |
'Total' => 'Total', | |
'Payment method' => 'Método de pago', | |
'Direct bank transfer' => 'Transferencia bancaria directa', | |
'Check payments' => 'Pagos con cheque', | |
'Cash on delivery' => 'Pago contra entrega', | |
'Credit card' => 'Tarjeta de crédito', | |
'Billing Address' => 'Dirección de facturación', | |
'Shipping Address' => 'Dirección de envío', | |
'Ship to a different address?' => '¿Enviar a una dirección diferente?', | |
'Create an account?' => '¿Crear una cuenta?', | |
'I have read and agree to the website terms and conditions' => 'He leído y acepto los términos y condiciones del sitio web', | |
]; | |
if (isset($translations[$text])) { | |
return $translations[$text]; | |
} | |
} | |
return $translated; | |
}, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment