Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Hardcoded

From TYPO3Wiki
Jump to: navigation, search
This page belongs to the Hardcoded project (category Project)


Hardcoded labels

notice - Note

You found hardcoded texts in TYPO3?
Then add them here, please!


There are still many hardcoded labels. Have a look at this document to see which we mean.

If you found any hardcoded labels, please add them there!


If you want to help translating labels (which are no longer hardcoded) to your language, go here.


Current Project Members

  • Stefano Kowalke


What we do

TYPO3 uses quite a number of texts:

All texts you see in the backend are coded somewhere. Everything comes from a file in the sourcecode.

There are two possibilities for this to work:

The texts can either be hardcoded in a php-file or they can come from a special language-file:


Hardcoded text

Hardcoded text is written directly in a php-file:


PHP script:
<?php
...

$content = 'Upload Image<br/>';

...

?>

This text is always displayed as you see it above. There is no chance to change it (except changing it in the source-code - not the ideal way).

Because it cannot be changed that easily, we call this text hardcoded.

The big disadvantage is, that the text cannot be localized, if it is hardcoded.

Translatable text

Text, which can be translated, comes from a special language-file (so-called locallang-file), which contains the texts in the language the user has chosen.

The code above would then look like the following:

PHP script:
<?php
...

$content = $GLOBALS['LANG']->getLL('uploadImage') . '<br/>';

...

?>

As you can see, the text which was hardcoded before has now been replaced by a call to $GLOBALS['LANG']. The label which is used is the one named uploadImage.

Here TYPO3 takes the text which should be displayed from a special language-file. These files look like the following:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>

<T3locallang>

        <meta type="array">

                <description>TYPO3 Element Browser labels.</description>

                <type>module</type>

        </meta>

        <data type="array">

                <languageKey index="default" type="array">

                        <label index="removeLink">Remove link</label>

                        <label index="uploadImage">Upload Image</label>

                        <label index="update">Update</label>


                </languageKey>

        </data>

</T3locallang>


These files each contain a number of labels (e.g. our "uploadImage"). As you see these labels are still in English. But they can be translated easily using the translation-server, a server which is there just to translate TYPO3.

If a TYPO3-user updates his translations afterwards, he will get the newest version of the translated texts.

The big advantage is, that no longer the hardcoded English, but always the language, which the user has chosen, will be used.

This is why we change hardcoded texts to texts which are inserted using $GLOBALS['LANG'].