LogoSkills

i18n Templates

Internationalization translation pattern templates.

Internationalization translation pattern templates.


Template A: Basic Translation Structure#

strings.i18n.yaml (Korean)#

@@locale: ko

common:
  appName: ํŽซ๋ฉ”๋””
  ok: ํ™•์ธ
  cancel: ์ทจ์†Œ
  save: ์ €์žฅ
  delete: ์‚ญ์ œ
  edit: ์ˆ˜์ •
  close: ๋‹ซ๊ธฐ
  loading: ๋กœ๋”ฉ ์ค‘...
  error: ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค
  retry: ๋‹ค์‹œ ์‹œ๋„
  noData: ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค

auth:
  login: ๋กœ๊ทธ์ธ
  logout: ๋กœ๊ทธ์•„์›ƒ
  signUp: ํšŒ์›๊ฐ€์ž…
  email: ์ด๋ฉ”์ผ
  password: ๋น„๋ฐ€๋ฒˆํ˜ธ
  forgotPassword: ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์žŠ์œผ์…จ๋‚˜์š”?

navigation:
  home: ํ™ˆ
  search: ๊ฒ€์ƒ‰
  mypage: ๋งˆ์ดํŽ˜์ด์ง€
  settings: ์„ค์ •

strings_en.i18n.yaml (English)#

@@locale: en

common:
  appName: Petmedi
  ok: OK
  cancel: Cancel
  save: Save
  delete: Delete
  edit: Edit
  close: Close
  loading: Loading...
  error: An error occurred
  retry: Retry
  noData: No data available

auth:
  login: Login
  logout: Logout
  signUp: Sign Up
  email: Email
  password: Password
  forgotPassword: Forgot password?

navigation:
  home: Home
  search: Search
  mypage: My Page
  settings: Settings

Template B: Parameter Patterns#

User Greetings#

user:
  # name: User ' s name
  greeting:  ' $name๋‹˜, ์•ˆ๋…•ํ•˜์„ธ์š”! ' 
   welcomeBack:  ' $name๋‹˜, ๋‹ค์‹œ ์˜ค์…จ๊ตฐ์š”! ' 

   # date: Join date (yyyy-MM-dd format)
  memberSince:  ' $date์— ๊ฐ€์ž… ' 

   # count: Number of points
  points:  ' $count ํฌ์ธํŠธ ๋ณด์œ  ' 

   # level: Membership tier
  levelInfo:  ' $level ๋“ฑ๊ธ‰ ํšŒ์›์ž…๋‹ˆ๋‹ค '

Dart Usage Example#

// User greeting
Text(context.t.user.greeting(name: user.displayName))

// Points display
Text(context.t.user.points(count: user.points.toString()))

// Join date display
Text(context.t.user.memberSince(date: DateFormat('yyyy-MM-dd').format(user.createdAt)))

Template C: Pluralization Patterns#

Item Counts#

items:
  count(param=n):
    zero: ํ•ญ๋ชฉ ์—†์Œ
    one: ํ•ญ๋ชฉ 1๊ฐœ
    other: ํ•ญ๋ชฉ $n๊ฐœ

cart:
  itemCount(param=count):
    zero: ์žฅ๋ฐ”๊ตฌ๋‹ˆ๊ฐ€ ๋น„์–ด์žˆ์Šต๋‹ˆ๋‹ค
    one: ์žฅ๋ฐ”๊ตฌ๋‹ˆ์— ์ƒํ’ˆ 1๊ฐœ
    other: ์žฅ๋ฐ”๊ตฌ๋‹ˆ์— ์ƒํ’ˆ $count๊ฐœ

notifications:
  unread(param=count):
    zero: ์ฝ์ง€ ์•Š์€ ์•Œ๋ฆผ ์—†์Œ
    one: ์ฝ์ง€ ์•Š์€ ์•Œ๋ฆผ 1๊ฐœ
    other: ์ฝ์ง€ ์•Š์€ ์•Œ๋ฆผ $count๊ฐœ

messages:
  count(param=n):
    zero: ๋ฉ”์‹œ์ง€ ์—†์Œ
    one: ๋ฉ”์‹œ์ง€ 1๊ฐœ
    other: ๋ฉ”์‹œ์ง€ $n๊ฐœ

followers:
  count(param=n):
    zero: ํŒ”๋กœ์›Œ ์—†์Œ
    one: ํŒ”๋กœ์›Œ 1๋ช…
    other: ํŒ”๋กœ์›Œ $n๋ช…

Dart Usage Example#

// Cart item count
Text(context.t.cart.itemCount(count: cartItems.length))

// Notification badge
Badge(
  label: Text(context.t.notifications.unread(count: unreadCount)),
)

// Follower count
Text(context.t.followers.count(n: followerCount))

Template D: Context-Based Patterns#

Enum-Based Translation#

pet:
  type(context=PetType):
    dog: ๊ฐ•์•„์ง€
    cat: ๊ณ ์–‘์ด
    bird: ์ƒˆ
    fish: ๋ฌผ๊ณ ๊ธฐ
    hamster: ํ–„์Šคํ„ฐ
    other: ๊ธฐํƒ€

order:
  status(context=OrderStatus):
    pending: ๋Œ€๊ธฐ ์ค‘
    confirmed: ํ™•์ธ๋จ
    shipping: ๋ฐฐ์†ก ์ค‘
    delivered: ๋ฐฐ์†ก ์™„๋ฃŒ
    cancelled: ์ทจ์†Œ๋จ

payment:
  method(context=PaymentMethod):
    card: ์นด๋“œ ๊ฒฐ์ œ
    bank: ๊ณ„์ขŒ์ด์ฒด
    kakao: ์นด์นด์˜คํŽ˜์ด
    naver: ๋„ค์ด๋ฒ„ํŽ˜์ด

Dart Enum Definition#

// lib/domain/entity/pet_type.dart
enum PetType {
  dog,
  cat,
  bird,
  fish,
  hamster,
  other,
}

// Usage
Text(context.t.pet.type(context: pet.type))
Text(context.t.order.status(context: order.status))

Template E: Error Message Patterns#

Form Validation Errors#

validation:
  required: ํ•„์ˆ˜ ์ž…๋ ฅ ํ•ญ๋ชฉ์ž…๋‹ˆ๋‹ค
  email:
    invalid: ์˜ฌ๋ฐ”๋ฅธ ์ด๋ฉ”์ผ ํ˜•์‹์ด ์•„๋‹™๋‹ˆ๋‹ค
    exists: ์ด๋ฏธ ์‚ฌ์šฉ ์ค‘์ธ ์ด๋ฉ”์ผ์ž…๋‹ˆ๋‹ค
  password:
    tooShort: ๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ์ตœ์†Œ 8์ž ์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค
    tooWeak: ๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ๋„ˆ๋ฌด ์•ฝํ•ฉ๋‹ˆ๋‹ค
    mismatch: ๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค
  phone:
    invalid: ์˜ฌ๋ฐ”๋ฅธ ์ „ํ™”๋ฒˆํ˜ธ ํ˜•์‹์ด ์•„๋‹™๋‹ˆ๋‹ค

error:
  network: ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”
  server: ์„œ๋ฒ„ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค
  timeout: ์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค
  unauthorized: ๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค
  forbidden: ์ ‘๊ทผ ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค
  notFound: ์š”์ฒญํ•œ ์ •๋ณด๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค
  unknown: ์•Œ ์ˆ˜ ์—†๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค

Dart Usage Example#

// Form validation
TextFormField(
  validator: (value) {
    if (value == null || value.isEmpty) {
      return context.t.validation.required;
    }
    if (!EmailValidator.validate(value)) {
      return context.t.validation.email.invalid;
    }
    return null;
  },
)

// Error handling
result.fold(
  (failure) => ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(content: Text(context.t.error.network)),
  ),
  (success) => navigateToHome(),
);

Template F: Date/Time Patterns#

Relative Time#

time:
  justNow: ๋ฐฉ๊ธˆ ์ „
  minutesAgo:  ' $minutes๋ถ„ ์ „ ' 
   hoursAgo:  ' $hours์‹œ๊ฐ„ ์ „ ' 
   daysAgo:  ' $days์ผ ์ „ ' 
   weeksAgo:  ' $weeks์ฃผ ์ „ ' 
   monthsAgo:  ' $months๊ฐœ์›” ์ „ ' 
   yearsAgo:  ' $years๋…„ ์ „ ' 

   # Future
  inMinutes:  ' $minutes๋ถ„ ํ›„ ' 
   inHours:  ' $hours์‹œ๊ฐ„ ํ›„ ' 
   inDays:  ' $days์ผ ํ›„ '

Dart Usage Example#

String getRelativeTime(BuildContext context, DateTime dateTime) {
  final now = DateTime.now();
  final difference = now.difference(dateTime);

  if (difference.inMinutes < 1) {
    return context.t.time.justNow;
  } else if (difference.inMinutes < 60) {
    return context.t.time.minutesAgo(minutes: difference.inMinutes.toString());
  } else if (difference.inHours < 24) {
    return context.t.time.hoursAgo(hours: difference.inHours.toString());
  } else if (difference.inDays < 7) {
    return context.t.time.daysAgo(days: difference.inDays.toString());
  } else if (difference.inDays < 30) {
    return context.t.time.weeksAgo(weeks: (difference.inDays ~/ 7).toString());
  } else if (difference.inDays < 365) {
    return context.t.time.monthsAgo(months: (difference.inDays ~/ 30).toString());
  } else {
    return context.t.time.yearsAgo(years: (difference.inDays ~/ 365).toString());
  }
}

Template G: Rich Text Patterns#

legal:
  termsAgreement:  ' ์ด์šฉ์•ฝ๊ด€์— ๋™์˜ํ•ฉ๋‹ˆ๋‹ค.  < link > ์ž์„ธํžˆ ๋ณด๊ธฐ < /link > ' 
   privacyAgreement:  ' ๊ฐœ์ธ์ •๋ณด ์ฒ˜๋ฆฌ๋ฐฉ์นจ์— ๋™์˜ํ•ฉ๋‹ˆ๋‹ค.  < link > ์ž์„ธํžˆ ๋ณด๊ธฐ < /link > ' 

 marketing:
  promotion:  ' < highlight > ํŠน๋ณ„ ํ• ์ธ < /highlight >   ์ด๋ฒคํŠธ๊ฐ€ ์ง„ํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค! ' 
   newFeature:  ' ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.  < link > ํ™•์ธํ•˜๊ธฐ < /link > '

Dart Usage Example#

// Rich text builder
Text.rich(
  context.t.legal.termsAgreement(
    link: (text) => TextSpan(
      text: text,
      style: TextStyle(
        color: AppColors.primary,
        decoration: TextDecoration.underline,
      ),
      recognizer: TapGestureRecognizer()
        ..onTap = () => Navigator.pushNamed(context, '/terms'),
    ),
  ),
)

// Highlighted text
Text.rich(
  context.t.marketing.promotion(
    highlight: (text) => TextSpan(
      text: text,
      style: TextStyle(
        color: AppColors.accent,
        fontWeight: FontWeight.bold,
      ),
    ),
  ),
)

Slang Configuration Template#

slang.yaml#

# Slang configuration file
base_locale: ko
fallback_strategy: base_locale

# Input settings
input_directory: lib/translations
input_file_pattern: .i18n.yaml

# Output settings
output_directory: lib/src/translations
output_file_name: translations.g.dart
output_format: single_file

# Case settings
key_case: camel
key_map_case: camel
param_case: camel

# Other settings
string_interpolation: dart
flat_map: false
timestamp: true
statistics: true

# Interface generation (if needed)
interfaces:
  PageData:
    paths:
      - home
      - settings
      - profile

GPT Translation Hint Template#

Comments for Improving Translation Quality#

# App name - do not translate
common:
  appName: Petmedi

# Button text - keep short and clear
buttons:
  submit: ์ œ์ถœ  # Submit
  confirm: ํ™•์ธ  # Confirm, OK

# Pet-related terms - maintain friendly tone
pet:
  # Represents pet species
  type(context=PetType):
    dog: ๊ฐ•์•„์ง€  # puppy/dog - use  " dog "   for general
    cat: ๊ณ ์–‘์ด  # cat/kitty - use  " cat "   for general