|
| 1 | +--- |
| 2 | +id: faq |
| 3 | +title: Frequently Asked Questions |
| 4 | +--- |
| 5 | + |
| 6 | +This page addresses common questions and misconceptions about the Tolgee CLI. |
| 7 | + |
| 8 | +## Key Management and Default Values |
| 9 | + |
| 10 | +### Q: Does the CLI detect duplicate keys with different default values? |
| 11 | + |
| 12 | +**A: No, currently the CLI does not detect this scenario.** |
| 13 | + |
| 14 | +If you have the same key with different default values in your code: |
| 15 | + |
| 16 | +```jsx |
| 17 | +<T keyName="save-btn" defaultValue="Save" /> |
| 18 | +<T keyName="save-btn" defaultValue="Save (Changed)" /> |
| 19 | +``` |
| 20 | + |
| 21 | +The CLI will not warn you about this conflict. This is a known limitation. |
| 22 | + |
| 23 | +**Recommended approach**: Use consistent default values across your codebase, or better yet, rely on the Tolgee Platform as the single source of truth for all translations. |
| 24 | + |
| 25 | +### Q: Why don't default values automatically update my base language translations? |
| 26 | + |
| 27 | +**A: This is by design to prevent conflicts between code and platform translations.** |
| 28 | + |
| 29 | +When you first sync a key, the default value becomes the base language translation. However, subsequent changes to default values in code will not update the platform translation. This prevents situations where: |
| 30 | + |
| 31 | +- A developer changes a default value in code |
| 32 | +- A translator or PM has already refined the wording in the platform |
| 33 | +- The two sources of truth conflict with each other |
| 34 | + |
| 35 | +### Q: Can I search for strings in my code if I only store keys? |
| 36 | + |
| 37 | +**A: This depends on your approach to translation management.** |
| 38 | + |
| 39 | +If you follow Tolgee's recommended approach of using the platform as the single source of truth: |
| 40 | +- You would search for keys in your code: `grep -r "save-btn" src/` |
| 41 | +- Then look up the actual translation in the Tolgee Platform |
| 42 | + |
| 43 | +If you maintain fallback translations in your code: |
| 44 | +- You can search for both keys and translation strings |
| 45 | +- But you'll need to manage consistency between code and platform |
| 46 | + |
| 47 | +## Best Practices and Workflow |
| 48 | + |
| 49 | +### Q: Should I keep default values in my code? |
| 50 | + |
| 51 | +**A: Tolgee recommends against using default values as the source of truth.** |
| 52 | + |
| 53 | +Here's why: |
| 54 | +- **Single source of truth**: Having translations in both code and platform creates confusion |
| 55 | +- **Team collaboration**: PMs, UX designers, and translators can update wording directly in the platform |
| 56 | +- **Consistency**: Prevents conflicts between developer changes and translator/PM changes |
| 57 | + |
| 58 | +**Recommended approach**: Use keys without default values, and rely on the Tolgee Platform for all translation content. |
| 59 | + |
| 60 | +### Q: What about fallback translations for when the platform is unavailable? |
| 61 | + |
| 62 | +**A: Use the pull command to maintain local fallback files.** |
| 63 | + |
| 64 | +Instead of default values in code: |
| 65 | +1. Use `tolgee pull` to download translations to local files |
| 66 | +2. Configure your app to use these files as fallbacks |
| 67 | +3. Keep these files in version control |
| 68 | +4. Update them regularly via `tolgee pull` |
| 69 | + |
| 70 | +This approach gives you: |
| 71 | +- Reliable fallbacks without CDN dependency |
| 72 | +- Platform as single source of truth |
| 73 | +- Automatic updates via CLI |
| 74 | + |
| 75 | +### Q: How do I handle the workflow where I want to update translations from code? |
| 76 | + |
| 77 | +**A: Update translations directly in the Tolgee Platform, not in code.** |
| 78 | + |
| 79 | +Instead of changing default values in code: |
| 80 | +1. Update the translation in the Tolgee Platform UI |
| 81 | +2. Use the platform's features like translation memory, suggestions, and collaboration |
| 82 | +3. Pull the updated translations to your local files if needed |
| 83 | + |
| 84 | +This workflow: |
| 85 | +- Keeps the platform as the authoritative source |
| 86 | +- Allows non-developers to manage translations |
| 87 | +- Prevents conflicts and inconsistencies |
| 88 | + |
| 89 | +## Technical Limitations |
| 90 | + |
| 91 | +### Q: Will duplicate key detection be added in the future? |
| 92 | + |
| 93 | +**A: This is a known limitation that may be addressed in future versions.** |
| 94 | + |
| 95 | +Currently, the CLI focuses on extracting keys and syncing with the platform. Enhanced validation features like duplicate detection are being considered for future releases. |
| 96 | + |
| 97 | +### Q: Can I force the CLI to update base language translations from default values? |
| 98 | + |
| 99 | +**A: No, this is not supported and goes against Tolgee's recommended workflow.** |
| 100 | + |
| 101 | +The CLI is designed to treat the platform as the authoritative source for translations. If you need to update base language translations, do so directly in the Tolgee Platform. |
0 commit comments