Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@shotlingo/text-expansion

npm version npm downloads license GitHub stars

Translation length expansion ratios for App Store screenshot localization.

Predicts how long a piece of UI copy will be after translating from English into 40+ target languages. Useful for sizing buttons, headlines, and screenshot text overlays so layouts don't break post-translation.

Ratios are derived from real localized screenshot pairs in the Shotlingo dataset — text rendered into actual screenshot frames across 40+ App Store languages, not synthesized from a single dictionary.

Install

npm install @shotlingo/text-expansion

Usage

import {
  EXPANSION,
  ratioFor,
  estimateChars,
  estimateWidth,
  worstExpansion,
} from '@shotlingo/text-expansion';

const en = 'Design stunning app store screenshots in minutes';

estimateChars(en, 'de');
// 65  ← German is ~35% longer

estimateChars(en, 'ja');
// 26  ← Japanese is ~45% shorter

estimateWidth(en, 'zh-Hans');
// 48  ← Chinese: fewer chars but ~same rendered width

worstExpansion(en, ['de', 'fr', 'ja', 'ar']);
// { iso: 'de', length: 65 }  ← German blows the layout — size for this

ratioFor('ar');
// { iso: 'ar', name: 'Arabic', charPct: 25, widthPct: 30, rtl: true }

Use in a layout-budget check at build time

// At build time: warn if any UI string would overflow in any shipped language.
import { worstExpansion } from '@shotlingo/text-expansion';

const SHIPPED_LOCALES = ['en', 'de', 'fr', 'es', 'ja', 'zh-Hans', 'ar'];

for (const [key, en] of Object.entries(STRINGS_EN)) {
  const worst = worstExpansion(en, SHIPPED_LOCALES);
  if (worst.length > MAX_BUTTON_WIDTH_CHARS) {
    console.warn(`"${key}" overflows in ${worst.iso} (${worst.length} chars)`);
  }
}

Companion tool

Text Expansion Calculator (Shotlingo) — paste English copy, see side-by-side per-locale length + visual width per target language. Same dataset, but visual instead of programmatic.

Shotlingo localizes App Store screenshots into 40+ languages and auto-sizes text overlays so this kind of overflow never ships.

See also

Related tools

License

MIT © Alperen Güntekin


Made by App Store screenshot generator — Shotlingo, App Store screenshot localization for 40+ languages.

About

Translation length expansion ratios for App Store screenshot localization - npm package

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages