Using Language Keys

From Cheetah Documentation Wiki
Revision as of 11:26, 14 October 2021 by Admin (talk | contribs)
Jump to navigation Jump to search

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:

![](http://i.imgur.com/LmMgrrN.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:

![](http://i.imgur.com/nr0J367.png)

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

![](http://i.imgur.com/7bwfLZX.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:

![](http://i.imgur.com/VSLhP8c.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.