-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Mode
Enable developer mode to display debug information instead of actual translations. This is useful for verifying that your app is correctly using translation keys and arguments.
// Enable developer mode
LayrzI18n.setDeveloperMode(true);
// Disable developer mode (default)
LayrzI18n.setDeveloperMode(false);Developer mode is a static, global flag that affects all LayrzI18n instances in your app.
When developer mode is enabled, each translation method returns a debug string instead of the actual translation:
// Normal: 'Hello, Alice!'
// Developer mode: 'greeting : {"name":"Alice"}'
i18n.t('greeting', {'name': 'Alice'})Returns the translation key, followed by : and the JSON-encoded argument map.
// Normal: '5 items'
// Developer mode: 'items|5 : {"count":"5"}'
i18n.tc('items', 5, {'count': '5'})Returns the translation key, followed by |, the count value, and the JSON-encoded argument map.
// Normal: TextSpan with rendered rich text
// Developer mode: TextSpan with text 'greeting : args: {"name":"Alice"} | richArgs.keys: [text]'
i18n.te('greeting', args: {'name': 'Alice'}, richArgs: {'text': TextSpan(...)})Returns a TextSpan containing the translation key, plain arguments (JSON-encoded), and rich argument keys (comma-separated).
// Normal: TextSpan with rendered rich text
// Developer mode: TextSpan with text 'items | 5 : args: {"count":"5"} | richArgs.keys: [units]'
i18n.tce('items', 5, args: {'count': '5'}, richArgs: {'units': TextSpan(...)})Returns a TextSpan containing the translation key, count, plain arguments (JSON-encoded), and rich argument keys (comma-separated).
Developer mode helps you:
- Verify key usage: Quickly check whether the app is using the correct translation keys
- Debug arguments: Ensure arguments are being passed correctly to translation methods
- Identify missing translations: See which keys are being requested but may not exist in your backend
- Test layout with long strings: Debug strings display the raw message structure without interpolation
Disable developer mode before shipping to production.
Made with ❤️ by Golden M, Inc.