Files
anki/docs-site/rtl.js
Abdo 22f90814e3 Add translation support for docs website (#5052)
## Linked issue

Closes #5004

## Summary

This adds intro entries for languages that have manual translations
listed under https://docs.ankiweb.net/#translations
Only placeholder pages with links to the contributor websites for now.


## How to test

Run `mint dev` under docs-site and try switching the language from the
top left.
2026-06-22 18:54:01 +03:00

31 lines
805 B
JavaScript

(function () {
var RTL_LANGS = ['ar', 'fa', 'he', 'ug', 'yi'];
function applyDirection() {
var lang = window.location.pathname.split('/')[1];
if (RTL_LANGS.indexOf(lang) !== -1) {
document.documentElement.classList.add('is-rtl');
} else {
document.documentElement.classList.remove('is-rtl');
}
}
applyDirection();
// Handle browser back/forward navigation in the SPA
window.addEventListener('popstate', applyDirection);
// Intercept pushState/replaceState for client-side routing
var _push = history.pushState;
history.pushState = function () {
_push.apply(this, arguments);
applyDirection();
};
var _replace = history.replaceState;
history.replaceState = function () {
_replace.apply(this, arguments);
applyDirection();
};
})();