#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Apply vn_dict2 one-pass replacements (longest-key-first) to all theme files. Backs up changed files into /tmp/trans_bak/. Reports any Chinese remaining.""" import os, re, sys, shutil sys.path.insert(0, '/tmp') from vn_dict2 import PAIRS ROOT = sys.argv[1] # unique, longest first pairs = sorted(set(PAIRS), key=lambda kv: -len(kv[0])) keys = [k for k, v in pairs] repl = dict(pairs) pat = re.compile('|'.join(re.escape(k) for k in keys)) changed = [] for dp, dn, fn in os.walk(ROOT): for f in fn: if not f.endswith(('.php', '.html', '.htm', '.js')): continue p = os.path.join(dp, f) s = open(p, encoding='utf-8', errors='replace').read() ns = pat.sub(lambda m: repl[m.group(0)], s) if ns != s: rel = p.replace(ROOT + '/', '') os.makedirs('/tmp/trans_bak/' + os.path.dirname(rel), exist_ok=True) shutil.copy2(p, '/tmp/trans_bak/' + rel) open(p, 'w', encoding='utf-8').write(ns) changed.append(rel) print("changed files:", len(changed)) for c in sorted(changed): print(" ", c) breakpoints: { 320: { //Khi bề rộng nhỏ hơn hoặc bằng 370 slidesPerView: 3, spaceBetween: 0 }, 980: { //Khi bề rộng nhỏ hơn hoặc bằng 370 slidesPerView: 5, spaceBetween: 30 }, } }); var historyContent = new Swiper('.swiper-content', { speed: 500, slidesPerView: 'auto', centeredSlides: true, roundLengths: true, parallax: true, on: { init: function() { this.slides.removeClass('init'); } }, breakpoints: {}, thumbs: { swiper: historyTimeline, } });