In screen shot bellow "Join our growing site, &meet dozens of singles today" is a phrase visible on Front end of the site. However in source code this phrase is not stored as is. Instead it is stored as a text key: {text key='customindex+slider_slogan'}
Usage of text keys instead of phrases:
- enables multilingual website/apps: as site admin you can easily translate single key into several languages. Thus phrase on Front end of the site will change depending on the language selected by user.
- easy management of phrases in Admin Panel: as site admin you can edit phrases in Admin Panel instead of editing source code every time you need to make a change
Text key strucutre:
Sample structure: {text key='prefix+key'}
Example: {text key='admin+permissions_delete_confirmation'}
Each text keys consists of 2 parts: prefix and key.
Prefix - is a plugin or feature text belongs to.
Key- is a unique identifier.
Prefix and key are separated by "+" sign.
For example in {text key='admin+permissions_delete_confirmation'} text key:
- admin - is prefix
- permissions_delete_confirmation - is key
Managing text keys in Admin panel: how to search for a key
Text keys are managed in Admin Panel >> Settings>> Languages>> "Edit language" tab.
To find text key you can use 2 options: searching by phrase and searching by key
Option 1: Searching by phrase.
This method is useful when you want to edit existing phrase and don't know it's key. For example, on front end you see following phrase "Join our growing site, &meet dozens of singles today" when you view the site in English language. To find this phrase:
- Go to Admin Panel >> Settings>> Languages>> "Edit language" tab
- Select English under "You are editing" drop down, as the phrase is in English. If you are checking the site in another language, select corresponding language from drop down
- Paste part of the phrase into search box (ex: Join our growing site) and click "Go"
- You will find single or multiple phrases in search results depending how often the phrase is used sitewide. Edit all found phrases OR add numbers before each phrase>> save changes>> check back front end of the site>> find out which number appeared on front end>> go back to phrase search results>> edit only the key with found number>> remove numbers from other phrases
Option 2: Searching by key.
This method is useful if you know key of the phrase. This usually happens when key is provided in setup guide, by SkaDate Support or when the phrase is un-translated and key is visible on front end. Let's review each scenario separately.
When key is provided in setup guides or by SkaDate support, they are given in following format:{text key='prefix+key'} . Example: {text key='admin+permissions_delete_confirmation'}.To find such keys:
- Copy only the key ( remember key is unique identified after(!) the prefix and + sign. Copy onlt the key without any extra symbols. In our case we copy following part: permissions_delete_confirmation
- Go to Admin Panel >> Settings>> Languages>> "Edit language" tab
- Paste key into search box>> check "in keys" box(!)>> Go:
- You will find single or multiple search results depending how often key is used within the source code. However key search results are always more preceice then phrase search results.
When key does not have a phrase in certain language you will see situation simular to the screen shot bellow. In our example we are checking the site in DE language and some keys are missing translation. When translation is missing, software displays prefix+key on the front end right away:
To find such keys:
- Copy only the key ( remember key is unique identified after(!) the prefix and + sign. Copy only the key without any extra symbols. In our case we will copy following part: text_block_title_1
- Go to Admin Panel >> Settings>> Languages>> "Edit language" tab
- Under "You are editing" we select "German" language since in our case translation is missing in DE language
- Paste key into search box>> check "in keys" box(!)>> Go:
Managing text keys in Admin panel: adding translations
In this section of the guide we will review how to edit existing and add missing phrase translations.
Important: Translations should always be based on search results by keys, not phrases.
Case1: Let's assume we installed Spanish language packag downloaded from https://hello.skadate.com/index.php?rp=/download/category/28/Languages.html .
We don't like some translations from the package and would like to edit them. In this case we DO know keys ( from guides, SkaDate Support team or just saw keys on the site):
What to do:
- Go to Admin Panel>> Settings>> Languages
Case2:
Let's assume we installed Spanish language packag downloaded from https://hello.skadate.com/index.php?rp=/download/category/28/Languages.html .
We don't like some translations from the package and would like to edit them. Example: we don't like "Para Aproba" phrase from screen shot bellow, but we don't know phrase's key:
What to do:
- Go to Admin Panel>> Settings>> Languages
- In upper right corner select EN under dropdown with flags
- Under "You are editing" drop down in the middle of the page select "Spanish"
- Enter Para Aproba into search box>> leave "in keys" box unchecked(!) as we are searching by a phrase>> Go
- In upper right corner select EN under dropdown with flags
- In our example we found 2 text keys. We don't know which one is responsible for "Para Aproba" phrase displayed in our first screen shot. To find out which phrase we need to edit, we add numbers next to phrases in search results
- We check back front end and see that number 1 is resonsible for our phrase
- We go back to phrase search result>> remove all extra un-needed numbers>> copy key of needed phrase only. In our case we remove number 2>> save this page. Then we copy console_for_approval>> and do search by key instead of phrase. This time we will see more preceise search results:
- We can now edit the phrase under "Translation:Spanish(es) column>> save this page. Note: under the "Orignal value:English" column in black font we can see English value for our reference so that we know what we are translating
- Bonus: since we are using search by keys, we can also switch to OTHER language using "You are editing" drop down and correct SAME phrase in other languages if we would like to