Difference between revisions of "Using Language Keys"

From Cheetah Documentation Wiki
Jump to navigation Jump to search
 
Line 15: Line 15:
 
Language Keys are managed with the rest of the language system, from the Admin Panel => Settings => Languages. It looks like this:
 
Language Keys are managed with the rest of the language system, from the Admin Panel => Settings => Languages. It looks like this:
  
[[File:687474703a2f2f692e696d6775722e636f6d2f4c6d4d6772724e2e706e67.png|200px]]
+
[[File:687474703a2f2f692e696d6775722e636f6d2f4c6d4d6772724e2e706e67.png|800px]]
  
 
For this tutorial, we'll focus on the first page ("Keys"). It only has a search box, which allows us to search for existing Language Keys. To search, enter the key or display text you want to edit, and then tick the Apply box. You should see some results if there were matches. Let's search for the "_copyright" key to edit the footer's copyright text:
 
For this tutorial, we'll focus on the first page ("Keys"). It only has a search box, which allows us to search for existing Language Keys. To search, enter the key or display text you want to edit, and then tick the Apply box. You should see some results if there were matches. Let's search for the "_copyright" key to edit the footer's copyright text:
  
[[File:https://camo.githubusercontent.com/c5e6e57c41440c201cc5fcd5758d5aa0f332110c0ce6dcf78b0ace03ce00d3c5/687474703a2f2f692e696d6775722e636f6d2f6e72304a3336372e706e67]]
+
[[File:687474703a2f2f692e696d6775722e636f6d2f6e72304a3336372e706e67.png|800px]]
  
 
You can also search for the display text if you don't know the actual Language Key:
 
You can also search for the display text if you don't know the actual Language Key:
  
[[File:https://camo.githubusercontent.com/11b4f7c3de97b7cc5d012627546dfb9d341947ad3dd13469afdb9e97e9165912/687474703a2f2f692e696d6775722e636f6d2f376277664c5a582e706e67]]
+
[[File:687474703a2f2f692e696d6775722e636f6d2f376277664c5a582e706e67.png|800px]]
  
 
To preview or edit the results, click the Edit link next to the Language Key. This will open an edit window with the display text for each installed language:
 
To preview or edit the results, click the Edit link next to the Language Key. This will open an edit window with the display text for each installed language:
  
[[File:https://camo.githubusercontent.com/c08dbf2d30963435044f1b55747924cb24a25ef26255991ddc7c62381820d9cd/687474703a2f2f692e696d6775722e636f6d2f56534c685038632e706e67]]
+
[[File:687474703a2f2f692e696d6775722e636f6d2f56534c685038632e706e67.png|800px]]
  
 
To edit, change the String Text value for your language and click the Save button. Changes should take effect almost immediately. If not, try clearing Cheetah's cache from the Admin Panel => Tools => Cache, and click the Clear All link.
 
To edit, change the String Text value for your language and click the Save button. Changes should take effect almost immediately. If not, try clearing Cheetah's cache from the Admin Panel => Tools => Cache, and click the Clear All link.

Latest revision as of 11:40, 14 October 2021

Cheetah features a powerful language system that makes it possible to translate almost every part of the site. This is done with what are called Language Keys.

What's a Language Key?

A Language Key is a kind of placeholder text, which allows a button, page, title, etc. to be shown in different languages based on the user's language settings. Most Language Keys look like this:

_exampleLanguageKey

When Cheetah sees this text, it checks the database for matching keys. When it finds one, it looks up the value for that user's language. So for example, User A will see the text on the site as "Example Language Key", while User B will see "Языковой ключ, для примера". Almost all non-user-added text in Cheetah uses Language Keys.

Managing Language Keys

Language Keys are managed with the rest of the language system, from the Admin Panel => Settings => Languages. It looks like this:

687474703a2f2f692e696d6775722e636f6d2f4c6d4d6772724e2e706e67.png

For this tutorial, we'll focus on the first page ("Keys"). It only has a search box, which allows us to search for existing Language Keys. To search, enter the key or display text you want to edit, and then tick the Apply box. You should see some results if there were matches. Let's search for the "_copyright" key to edit the footer's copyright text:

687474703a2f2f692e696d6775722e636f6d2f6e72304a3336372e706e67.png

You can also search for the display text if you don't know the actual Language Key:

687474703a2f2f692e696d6775722e636f6d2f376277664c5a582e706e67.png

To preview or edit the results, click the Edit link next to the Language Key. This will open an edit window with the display text for each installed language:

687474703a2f2f692e696d6775722e636f6d2f56534c685038632e706e67.png

To edit, change the String Text value for your language and click the Save button. Changes should take effect almost immediately. If not, try clearing Cheetah's cache from the Admin Panel => Tools => Cache, and click the Clear All link.