Després de 16 anys d’operació i més de dos anys sense un nou llançament, El nostre complement es va trobar amb un repte generalitzat conegut com a Rot Code. Aquest problema sorgeix quan la funcionalitat es degrada amb el pas del temps, fins i tot sense canvis en el codi del complement, es basa en factors externs. Nous llançaments de WordPress, Versions PHP actualitzades, i els canvis en els serveis de traducció poden alterar funcions dissenyades amb cura.
A la versió 1.0.9.5, Hem afrontat aquests reptes, Amb un focus principal en els motors de traducció. Hem eliminat el codi obsolet i hem introduït noves implementacions per restaurar el suport per als serveis de traducció de Yandex i Baidu, que havia deixat de treballar els darrers anys. Aquestes actualitzacions asseguren que les funcions de traducció estiguin completament operatives una vegada més. Addicalment, Hem ampliat el suport d’idiomes per incloure nous idiomes afegits a aquests serveis de traducció al llarg del temps.
Aquesta versió reflecteix la nostra dedicació a mantenir el complement fiable i eficaç, Adaptació al paisatge evolutiu de tecnologies i serveis.

Hem introduït un nou giny que utilitza emojis de bandera estàndard, que s’han incorporat al conjunt emoji al llarg dels anys. Aquesta actualització simplifica significativament el codi del giny, alhora que també permet una personalització fàcil de les banderes per satisfer les vostres necessitats específiques.
Podeu consultar aquest nou widget en acció al nostre lloc, On hem afegit un truc CSS intel·ligent que fa que la icona de la llengua actual sigui el doble de la de les altres, aconseguit amb només les dues línies de codi següents!.transposh_flags{font-size:22px}
.tr_active{font-size:44px; float:left}
Esperem que gaudiu d’aquesta nova versió!
Com traduir el vostre títol i descripció de Meta amb Transposh!
Després d'alguns “codificació de vibració” Com diuen (Les persones que no saben codificar, però encara codifiquen amb IA) Vaig esbrinar de manera creativa com traduir el títol i la descripció del meta quan utilitzava Transposh.
Com a tipus de màrqueting de SEO, que era una cosa que realment em molestava. Llocs traduïts, Amb els resultats de l’anglès a Google.
Llavors, com ho vaig fer.
Primer vaig afegir aquest fragment PHP (Creat per Grok 3)
Això va traduir el meta títol per a mi.
I called it Meta Title and Description in WP Snippet:
add_filter('rank_math/frontend/title', function($title) {
global $my_transposh_plugin;
// Controleer of Transposh actief is
if (!isset($my_transposh_plugin) || !is_object($my_transposh_plugin)) {
return $title;
}
// Haal de huidige taal op
$lang = transposh_get_current_language();
// Vertaal alleen als de taal niet de standaardtaal is
if ($lang && !$my_transposh_plugin->options->is_default_language($lang)) {
// Gebruik fetch_translation om de title te vertalen
list(, $translated_title) = $my_transposh_plugin->database->fetch_translation($title, $lang);
if ($translated_title) {
$title = $translated_title;
}
}
return $title;
});
add_filter('rank_math/frontend/description', function($description) {
global $my_transposh_plugin;
// Controleer of Transposh actief is
if (!isset($my_transposh_plugin) || !is_object($my_transposh_plugin)) {
return $description;
}
// Haal de huidige taal op
$lang = transposh_get_current_language();
// Vertaal alleen als de taal niet de standaardtaal is
if ($lang && !$my_transposh_plugin->options->is_default_language($lang)) {
// Gebruik fetch_translation om de description te vertalen
list(, $translated_description) = $my_transposh_plugin->database->fetch_translation($description, $lang);
if ($translated_description) {
$description = $translated_description;
}
}
return $description;
});
– After this snippet > The Title was translated, but not the description. After further vibing and reaching a dead-end with Grok i figured that basically the transposh plugin was fetching the translation from the database multiple times.
So i told Grok, hey if we add the meta title and description in the footer (hidden) as text.
And Transposh translates it, if we than pull the description from the database that transposh manages for us wouldn’t it be translated?
And Grok3 confirmed and gave me this snippet (after giving me a compliment for thinking outside the box)
// Voeg de meta title en description toe aan de footer, alleen als de description is ingevuld
add_action('wp_footer', function() {
global $post;
if (is_singular() && $post) {
$meta_title = get_post_meta($post->ID, 'rank_math_title', true);
$meta_description = get_post_meta($post->ID, 'rank_math_description', true);
// Controleer of de meta description is ingevuld
if (!empty($meta_description)) {
// Standaard meta title als deze leeg is
if (empty($meta_title)) {
$meta_title = get_the_title($post->ID);
}
?>
document.addEventListener('DOMContentLoaded', function() {
var metaElement = document.getElementById('transposh-meta');
if (metaElement) {
var translatedText = metaElement.innerText || metaElement.textContent;
// Splits de tekst weer op in title en description (na vertaling)
var parts = translatedText.split(' | ');
var translatedDesc = parts[1] || translatedText; // Gebruik description na de |, anders hele tekst
var metaTag = document.querySelector('meta[name="description"]');
if (metaTag) {
metaTag.setAttribute('content', translatedDesc);
} else {
var newMeta = document.createElement('meta');
newMeta.name = 'description';
newMeta.content = translatedDesc;
document.head.appendChild(newMeta);
}
}
});
<?php
}
}
});
Just note, that I was using Rankmath as my SEO plugin, This maybe will work with Yoast? Or Other plugins, but I am sure if you feed this entire comment to an AI tool of your choice it could fix the correct fields for Yoast and others.
Happy Translating guys and thank you for picking up the support of this plugin after so many years 🙂
One of my top 3 secret weapons for sure!
Sorry I forgot to mention something.
// Voeg de meta title en description toe aan de footer, alleen als de description is ingevuld
If you’d translate this to english it says Add the meta title and description to the footer only if the description is filled in.
The reason why only if it’s filled in is the same reason why I figured this footer trick would work.
If I had a unique meta description for my pages, that was not on the website. It was not translated.
But when I didn’t add a translation at all, and kept it empty, it will pull the top words of the page. So when I only added the first snippet above, it was only translating the title, because the title is also written on the page. but the meta description was unique and nowhere seen on the website.
That’s basically how I figured out if we add an invisible meta description in the footer > we can translate meta titles and descriptions with that first snippet above.
So you need both snippets for it to work.
Or only the first if you never fill in your descriptions anyways. don’t bother.
When I save post, It shows this error:
Advertència: Undefined array key “b” in \wp-content\plugins\transposh-translation-filter-for-wordpress\core\constants.php on line 1702
I solved it by changing this code on line 1702
si ($langrec[‘engines’][$motor]) {
a
si (isset($langrec[‘engines’][$motor])) {
Gràcies per informar d'aquest, fixa en https://github.com/oferwald/transposh/commit/70f1a6bafc72a0358b42ada8a576a9f02b5ed136