- Preventing NPM Supply Chain Attacks2026-04-16
- AI Agent Tools I'm Using in 20262026-03-11

I recently refreshed my self-made personal website template: Letter, and something that caught my attention was the following snippet:
{t('Hero-1', { name: t('Me-1') })}<br />{t('Hero-2', { number: '100' })} <a class="highlight" href={`https://www.webdong.dev/${Astro.currentLocale}/post/`}>{t('Hero-3')}</a> {t('Hero-4')} {t('Hero-5', {number: '800'})}{t('Hero-6')} <a class="highlight" href={getRelativeLocaleUrl(Astro.currentLocale || defaultLocale, '/work')}>{t('Hero-7')}</a> {t('Hero-8')}"Hero-1": "哈囉,我是{name}","Hero-2": "我撰寫超過 {number} 篇","Hero-3": "技術文章","Hero-4": "紀錄與傳達知識","Hero-5": "幫助 {number} 位以上開發者消除他們的疑惑。","Hero-6": "可以觀賞","Hero-7": "作品集","Hero-8": "了解我是如何解決真實世界問題的。",It’s a bit ugly and just thinking about replacing it is a headache — especially for languages with significantly different word order where it simply won’t work. So it’s better to write it like this, splitting by “concepts rather than word order or styling”:
<Fragment set:html={t('Hero-2', {articles: '100',articlesLink: `<a class="highlight" href="https://www.webdong.dev/${Astro.currentLocale}/post/">${t('Hero-ArticlesLink')}</a>`,developers: '800'})} /><Fragment set:html={t('Hero-3', {portfolioLink: `<a class="highlight" href="${getRelativeLocaleUrl(Astro.currentLocale || defaultLocale, '/work')}">${t('Hero-PortfolioLink')}</a>`})} />"Hero-2": "我撰寫超過 {articles} 篇{articlesLink}紀錄與傳達知識,幫助 {developers} 位以上開發者消除他們的疑惑。","Hero-3": "可以觀賞{portfolioLink}了解我是如何解決真實世界問題的。","Hero-ArticlesLink": "技術文章","Hero-PortfolioLink": "作品集",At the time I probably did this to keep the translation files pure, avoiding mixing in styles or markup structure, and to avoid potential XSS issues. However, most of the time writing the markup directly into the translations is easier… besides, I can compose it from the outside using parameters.
tis a homemade i18n translation utility; most i18n libraries should have a similar placeholder mechanism for handling translations.- How to Clean a Macbook2026-01-11
- Why Not Lazily Evaluate Everything?2025-11-05
- Asking Strange Questions Helps Everyone2025-10-19
- Me and Aphantasia2025-09-01
- Think About Learning2025-08-14
- Not Comparing Yourself with Others2025-07-07
- Thoughts on Career Choice Factors2025-06-08
- Thoughts on Presenting Resume Statistics2025-05-14
- The Most Unique Interview Experience2025-05-08
- Is TypeScript a Linter? How to View TS?2025-02-11
- Why You Should Use pnpm?2025-02-03
- Impact of Excessive DOM Size2025-01-31
- How to Maintain Motivation?2024-12-29
- Online File Structure ASCII Generator2024-12-04
- Are Git Pre-Commit Hooks Good or Bad?2024-11-28
- Guideline for Color Contrast in Web2024-11-23
- What is an Accessible Web Page?2024-11-14
- How to publish local website and server2024-11-09
- Digital Garden Template — Quartz2024-11-01
- Frontend and SEO2024-10-14
- Browser Zoom cause Display Errors2024-10-05
- How to Manage Utility Functions2024-08-15
- Put AI on CI - PR Agent2024-08-13
- CSS blur() Performance Issues in Safari2024-08-12
- The bfcache Causes Issues Between Pages2024-07-31
- What is the Barrel File pattern?2024-07-30
- Why Should Software Be Tested?2024-07-23
- Organize Tailwind and UI variable2024-07-13
- Do Not Tell Users "Read More"2024-07-04
- How to Escape a Container with CSS Grid2024-07-03
- Generate Fake Data with TestDataHub2024-07-02
- CSS Property Maximum Value2024-06-28
- Frontend Environment Diversity2024-06-21
- Cypress and jQuery2024-06-20
- About Low-code / No-code2024-06-19
- Story Between Me and Web Design2024-06-19
- Tips for Solving Problems2024-06-14
- Is it necessary to learn Sass in 2024?2024-06-13
- iOS Home Indicator safe area2024-06-12
- How to Achieve That Cool Web Background?2024-06-06
- Why Keep Package Versions Updated?2024-06-05
- Do You Remember Browser Vendor Prefixes?2024-05-31
- How to manage large files in Git?2024-05-30
- XML and AJAX2024-05-28
- Why are there _ in numbers?2024-05-23
- Software Gardener2024-05-21
- Chromium Developer Tools — Layers2024-05-12
- Visualizing JSON Data - JSON Crack2024-05-11
- About Handmade2024-05-08
- The Origin of the Database Icon2024-05-01
- About writing2024-04-22
- The fear of being replaced by AI2024-04-20
- About Running a Blog2024-04-15
- Free Web Image Editors - Photopea2024-04-14
- Chatting About TDD Concepts with Friends2024-04-13