Find a translation key with verbose localization

:bookmark: This documentation explains how to use verbose localization to find translation keys for custom text in Discourse.

:person_raising_hand: Required user level: Administrator

Finding a translation key using verbose localization

Verbose localization is a powerful tool in Discourse that helps administrators find translation keys for custom text more effectively. This is particularly useful when you need to translate text appearing in multiple places in the Discourse UI.

Summary

This guide covers:

  • Enabling verbose localization.
  • Using verbose localization to identify translation keys.
  • Practical applications and common use cases.

Enabling verbose localization

Verbose localization can be enabled for all users globally or for individual sessions.

Enabling the setting for all users

  1. Navigate to your site settings page
    a. Go to the admin sidebar
    b. Select All Site Settings
    b. Enter verbose in the filter field of the settings page
  2. Enable the verbose localization site setting.

Enabling the setting for an individual session

  1. Open your browser’s web inspector on your Discourse site.
  2. Go to the console tab.
  3. Enter the following JavaScript command at the prompt:
    I18n.enableVerboseLocalizationSession()
    
  4. You should see a response similar to:
    Verbose localization enabled

:information_source: This session-specific approach ensures that other users won’t see translation markers when visiting the site.

Using verbose localization to find a translation key

When verbose localization is enabled, you’ll see numbers displayed after all customizable text on your site.

Steps to identify a translation key

  1. Browse to the area containing the text you want to update. For example, if you’re looking to change the word “Name”:
  2. Look for the associated translation number in your browser’s console:
  3. Note the identified translation key, such as user.name.title.
  4. Go to the Admin sidebar and enter site texts into the Search bar
  5. Enter the translation key into the search box:
  6. Click the text’s Edit button and update the text as needed.

Best practices

  • Use session-specific verbose localization to avoid cluttering the UI for other users during translation tasks.
  • Document frequently used translation keys for future reference.
  • Regularly check for updates in the Discourse documentation to stay informed about new localization features.

Common issues and solutions

Issue: Translation markers visible to all users

Solution: Ensure you enable verbose localization exclusively for your session if other users shouldn’t see it.

Issue: Difficulty in finding correct translation key

Solution: Use the console and verbose localization markers accurately, and cross-reference the Customize Site Texts page.

FAQs

Q: Can verbose localization be restricted to admin or staff?
A: Verbose localization numbers can be hidden from non-technical users by enabling it in individual sessions via the console.

Q: How can string translations be verified?
A: After identifying and updating the translation key, review the UI changes in a new browser session or tab.

Additional resources

Last edited by @Moin 2024-07-22T10:35:10Z

Check documentPerform check on document:
27 Likes