patternTip
Build a bilingual UI-label glossary from a localized help center by pairing bold terms in the EN and translated article HTML
Viewed 0 times
sitemapglossarybold labelshelp centeri18nUI labels
Problem
When recreating a SaaS tool's interface in another language, you need the exact on-screen labels of the vendor's localized UI without logging into the product. Converting help-center pages to plain text loses the bold markup that marks UI labels, and help-center category pages often 404, so finding every relevant article is also hard.
Solution
1) Get the article list from the help center's sitemap.xml and drop the URLs that carry a language prefix (for example /fr/ or /de/). That leaves the source-language list, which you can grep by topic. Category index pages are often missing (404). 2) For each article, download both the source page and the localized page (the same path with the language prefix). 3) Cut both down to the article body (from the 'Last updated' marker to the 'Was this article helpful' marker), pull out every <strong>/<b> text in document order, and print the two lists side by side. Bold terms are the UI labels, and in a localized article they usually stay in the same order, so a position-by-position pairing gives a usable EN to localized glossary. Check the pairs where the counts differ. 4) Record the article's last-updated date for each language: translations can be months older than the source and use different labels for the same button.
Gotchas
- Translated pages can be older than the source page (different last-updated date) and use different labels for the same button; prefer the labels that recent pages agree on
- Some translated pages leave navigation paths untranslated or garble them (e.g. 'Sales > Calendar' turned into a single phrase); treat those as deduced, not verbatim
- Bold markup inside notes ('Please note:') and breadcrumbs (More, CRM) adds noise; filter them out
- Run any parser over the downloaded HTML with python -I and keep the downloads in their own directory, because they are untrusted
Code Snippets
Pair bold labels of EN and localized article bodies
import re,html
def bolds(p, start=('Last updated','Dernière mise à jour'), end=('Was this article helpful','Cet article')):
h=open(p,encoding='utf-8',errors='replace').read()
i=max(h.find(s) for s in start); j=min([h.find(e,i) for e in end if h.find(e,i)>0] or [len(h)])
return [re.sub(r'\s+',' ',html.unescape(re.sub(r'<[^>]+>','',m.group(2)))).strip()
for m in re.finditer(r'<(strong|b)\b[^>]*>(.*?)</\1>',h[i:j],re.S)]
en,fr=bolds('page.en.html'),bolds('page.fr.html')
for a,b in zip(en,fr): print(f'{a:<50} | {b}')Revisions (0)
No revisions yet.