Which file format do you prefer for PHP projects?

Hi everyone, I’m a developer working on a video CMS written in PHP. I’m planning to localize the web app UI into more languages and would like to set it up properly from the start. Which file format do you prefer for PHP projects: JSON, PO or XLIFF? I’d be glad to hear what has worked well for you, and any pitfalls with plurals or placeholders. Thanks!

Hi @colorfulcms, Crowdin supports all three, so the best choice mostly depends on what your PHP code already uses. If you’re on gettext, PO is the most natural fit. Plural forms are built into the format through msgid_plural and the Plural-Forms header for each language, and translators see the singular and plural forms side by side. JSON works well if your i18n library reads ICU MessageFormat, because plurals and named placeholders then live inside the string itself, for example {count, plural, one {# video} other {# videos}}. XLIFF is mainly an exchange format. It’s handy if you also send files to agencies or other CAT tools, but it’s heavier to maintain by hand. If your framework uses plain PHP array files, Crowdin supports those too.

A few pitfalls we often see:

  1. Building sentences by joining translated pieces together. Word order changes between languages, so keep each full sentence in one string.
  2. Using several %s placeholders in one string. Named placeholders or numbered ones like %1$s let translators reorder them.
  3. Hardcoding “if count == 1” logic in your code. Many languages have three or more plural forms, so let the format or library handle plurals.

It also helps to keep your keys stable and to add short context for strings that could be read more than one way. In a video CMS, “Play” or “Live” can mean several things.