Page MenuHomePhorge

Add fallback languages for locale files
ClosedPublic

Authored by pppery on Jun 19 2024, 20:12.

Details

Summary
Test Plan

Set any languages and observe untranslated strings display proper PLURAL rules

With the downstream "translations" extension installed, set the language to traditional Chinese and see Simplified Chinese rather than English translations if they exist, like "Foo added/removed a project"

Event Timeline

pppery requested review of this revision.Jun 19 2024, 20:12
src/internationalization/locales/PhutilPortugueseBrazilLocale.php
17

See T15861 for the issue here.

What's the current behavior for fallback from cs_CZ? Would it make sense to set the default to en_US in the base class?

The current behavior if a fallback locale is not specified is to fallback to the proto-English string (English without applying pluralization). It probably does make sense, now that you bring it up, to fall back to en_US instead by default instead of doing that in every locale.

Set fallback locale in base class

Don't make unnecessary whitespace changes

Done that. I left the technically-redundant methods where I have a lengthy comment explaining why I return en_US, since I think it's helpful to explain why that is.

This revision is now accepted and ready to land.Jun 21 2024, 09:23