Hey!
I need to have cart, checkout, and user notifications in a language that is not supported by Squarespace. The proposed Weglot solution isn't good because it adds a subdomain prefix ("et.example.com"). That's not acceptable. Users have to be able to use the main domain "example.com" in their native language.
It is a single-language website. Weglot solution works only if it's multilingual, using "example.com" and "et.example.com" domains.
Unless there is a way with Weglot to translate the main domain's ("example.com") cart, checkout, and user notifications? I haven't figured that out. Can I manipulate something within my DNS settings?
Also, I've tried to inject code, but it doesn't do anything. Probably some kind of restrictions for injecting code for checkout.
My code looks something like this:
<script>
function translateToEstonian(element) {
const translations = {
'Item': 'Toode',
'Quantity': 'Kogus',
'Price': 'Hind',
'Subtotal':'Vahesumma',
'Checkout':'Kassa',
// Add more translations as needed
};
const englishText = element.textContent.trim();
if (translations.hasOwnProperty(englishText)) {
const estonianText = translations[englishText];
element.textContent = estonianText;
}
}
// Select and translate elements in the Cart page
const cartElements = document.querySelectorAll('.cart-subtotal-label, .cart-total-label');
cartElements.forEach(translateToEstonian);
// Select and translate elements in the Checkout page
const checkoutElements = document.querySelectorAll('.checkout-subtotal-label, .checkout-total-label');
checkoutElements.forEach(translateToEstonian);
// Select and translate elements in the User Notifications
const notificationElements = document.querySelectorAll('.order-confirmation-title, .shipping-notification-title');
notificationElements.forEach(translateToEstonian);
</script>
I'm stuck. Can someone help?