Lingo.dev + .properties (Java)

Lingo.dev CLI는 키-값 구조, 이스케이프 시퀀스 및 Java 현지화 규칙을 보존하면서 Java .properties 파일을 번역합니다. CLI는 Java의 ResourceBundle 시스템과 원활하게 작동하고, properties 파일 형식을 정확히 유지하며, 유니코드 및 특수 문자 이스케이프를 올바르게 처리하고, MessageFormat용 {0}, {1} 플레이스홀더를 보존하며, Maven 및 Gradle 빌드 프로세스와 통합됩니다.

빠른 설정

Java properties 파일 구성:

{
  "locale": {
    "source": "en",
    "targets": ["es", "fr", "de"]
  },
  "buckets": {
    "properties": {
      "include": ["src/main/resources/messages_[locale].properties"]
    }
  }
}

주의사항: [locale]은 CLI 실행 중에 실제 로케일로 대체되므로 구성에서 문자 그대로 유지해야 하는 플레이스홀더입니다.

Properties 파일 번역

npx lingo.dev@latest i18n

값을 번역하는 동안 properties 파일 형식, 이스케이프 시퀀스 및 Java 특정 규칙을 보존합니다.

Properties 파일 구조

기본 키-값 쌍

welcome.message=Welcome to our application
login.button=Log In
logout.button=Log Out
error.invalid.credentials=Invalid username or password

네임스페이스 구성


# Authentication messages

auth.login.title=Sign In
auth.login.subtitle=Enter your credentials
auth.register.title=Create Account
auth.forgot.password=Forgot Password?

# Navigation items

nav.home=Home
nav.dashboard=Dashboard
nav.settings=Settings

MessageFormat 플레이스홀더

welcome.user=Welcome back, {0}!
items.count=You have {0} items in your cart
validation.min.length=Field must be at least {0} characters long
date.format=Today is {0,date,short}

Java 특정 기능

유니코드 이스케이프 시퀀스

japanese.greeting=\u3053\u3093\u306b\u3061\u306f
euro.symbol=Price: 100\u20ac

번역 중에 유니코드 이스케이프가 보존됩니다.

줄 연속

long.message=This is a very long message that \
    spans multiple lines for better \
    readability in the source file

특수 문자 이스케이프

file.path=C:\\Users\\Documents\\file.txt
key.with.spaces=key\ with\ spaces=value with spaces
special.chars=Contains \= equals and \: colons

고급 구성

다중 프로퍼티 파일

"properties": {
  "include": [
    "src/main/resources/messages_[locale].properties",
    "src/main/resources/validation_[locale].properties"
  ]
}

구성 키 잠금

"properties": {
  "include": ["src/main/resources/messages_[locale].properties"],
  "lockedKeys": ["app.version", "build.timestamp", "api.endpoint"]
}