10008b3d3e
Extend derived table syntax to support column name assignment. (subquery expression) [as|=] ident [comma separated column name list]. Prior to this patch, the optional comma separated column name list is not supported. Processing within the unit of the subquery expression will use original column names, outside the unit will use the new names. For example, in the query select a1, a2 from (select c1, c2, c3 from t1 where c2 > 0) as dt (a1, a2, a3) where a2 > 10; we see the second column of the derived table dt being used both within, (where c2 > 0), and outside, (where a2 > 10), the specification. Both conditions apply to t1.c2. When multiple unit preparations are required, such as when being used within a prepared statement or procedure, original column names are needed for correct resolution. Original names are reset within mysql_derived_reinit(). Item_holder items, used for result tables in both TVC and union preparations are renamed before use within st_select_lex_unit::prepare(). During wildcard expansion, if column names are present, items names are set directly after creation. Reviewed by Igor Babaev (igor@mariadb.com) |
||
---|---|---|
.. | ||
charsets | ||
CMakeLists.txt | ||
errmsg-utf8.txt | ||
insert_translations_into_errmsg.py | ||
README.md |
A quicker way for adding new language translations to the errmsg-utf8.txt file
Summary
To generate a new language translation of MariaDB use the following pull request (PR) as a template for your work:
You will notice as part of your translation work, you will have to add your language translations to the file sql/share/errmsg-utf8.txt
which is found in the current directory. This file is long with many sections which can make the translation work tedious. In this README, we explain a procedure and provide a script insert_translations_into_errmsg.py
that cuts down the amount of tedium in accomplishing the task.
Procedure
-
Start by grepping out all the english translations from errmsg-utf8.txt using the following grep command, and redirecting the output to a file:
grep -P "^\s*eng\s" errmsg-utf8.txt > all_english_text_in_errmsg-utf8.txt
-
Next use Google translate to obtain a translation of this file. Google translate provides the ability to upload whole files for translation. For example, this technique was used to obtain Swahili translations which yielded a file with output similar to the below (output is truncated for clarity):
sw "hashchk" sw "isamchk" sw "LA" sw "NDIYO" sw "Haiwezi kuunda faili '% -.200s' (kosa: %M)" sw "Haiwezi kuunda jedwali %
s.%
s (kosa: %M)" sw "Haiwezi kuunda hifadhidata '% -.192s' (kosa: %M)" sw "Haiwezi kuunda hifadhidata '% -.192s'; hifadhidata ipo"
Note that Google translate removes the leading whitespace in the translation file it generates. DO NOT add that leading whitespace back!
-
Give the translated file an appropriate name (e.g.
all_swahili_text_in_errmsg-utf8.txt
) and store it in the same directory witherrmsg-utf8.txt
andall_english_text_in_errmsg-utf8.txt
. These 3 files will be used by the script insert_translations_into_errmsg.py. -
Proof check the auto-translations in the file you downloaded from Google translate. Note that Google might ommit formating information that will cause the compilation of MariaDB to fail, so pay attention to these.
-
Reintegrate these translations into the errmsg-utf8.txt by running the insert_translations_into_errmsg.py script as follows:
chmod ugo+x insert_translations_into_errmsg.py # Make the script executable if it is not.
./insert_translations_into_errmsg.py <errmsg-utf8.txt file>
For example, for the swahili translation, we ran the following:
./insert_translations_into_errmsg.py errmsg-utf8.txt all_english_text_in_errmsg-utf8.txt all_swahili_text_in_errmsg-utf8.txt
The script uses the
errmsg-utf8.txt
file and the grepped english file to keep track of each new translation. It then creates a file in the same directory aserrmsg-utf8.txt
with the nameerrmsg-utf8-with-new-language.txt
. -
Check that the reintegration of the new translations into
errmsg-utf8-with-new-language.txt
went OK, and if it did, renameerrmsg-utf8-with-new-language.txt
toerrmsg-utf8.txt
:mv errmsg-utf8-with-new-language.txt errmsg-utf8.txt
-
In the header of errmsg-utf8.txt make sure to add your language long form to short form mapping. E.g. for Swahili, add:
swahili=sw