Changes between Version 38 and Version 39 of Event/2012/GSoC/Translation


Ignore:
Timestamp:
07/09/12 11:27:36 (13 years ago)
Author:
vivek_h
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Event/2012/GSoC/Translation

    v38 v39  
    2929'''Project Deliverables''' :- The idea of the project is to automate the entire process of selective translation by providing a tool that helps the translators to translate only the relevant strings in the code when it is deployed. Also, when the code is changed, some strings may no longer be required for translation and some new strings might be added, this tool accounts for such changes for consistent translation. A GUI will be developed to present the translation status for each active module. Addition of comments to the T(...) function must also be facilitated. Finally, the tool will ensure that the translations made by the translators is integrated back into the main code of Eden.
    3030
    31 1)''' Retrieval and storage of all strings based on modules'''  :- Initially, a python script would be run to collect all the strings in the Eden system based on the input module. This collection of strings will be stored in a separate file (different from the languages files)  such that each row would contain the original (untranslated) string, its location(pathname/line number), comments and a flag to indicate if it has been translated or not (initially all flags will be unset). Let us refer to this file as all_strings.txt. Note that the same string appearing in two different files will be placed in two different rows.
    32 Currently, we are focusing on the python parse tree generated by using the python parser library to get the strings from the ".py" files. Also file dependencies and structure are studied to discover which strings are grouped under the given module. The active modules will be passed as  parameters to the function and later on it can be taken as input from the developer using GUI checkboxes. Aslo settings such as "deployment.setting.variable_name" (inside T(...) ) will be extracted as it is initially and later their value will be retreived.
     311)''' Retrieval and storage of all strings based on modules'''  :- Initially, a python script would be run to collect all the strings in the Eden system based on the input module. This collection of strings will be stored in a separate file (different from the languages files)  such that each row would contain the original (untranslated) string, its location(pathname/line number), comments and a flag to indicate if it has been translated or not (initially all flags will be unset). Note that the same string appearing in two different files will be placed in two different rows.
     32Currently, we are focusing on the python parse tree generated by using the python parser library to get the strings from the ".py" files. Also file dependencies and structure are studied to discover which strings are grouped under the given module. The active modules will be passed as  parameters to the function and later on it can be taken as input from the developer using GUI checkboxes. Also settings such as "deployment.setting.variable_name" (inside T(...) ) will be extracted as it is initially and later their value will be retreived. (The strings inside both T(...) and M(...) will be retrieved. )
    3333
    34 2) '''Building a spreadsheet for translators''' :- The strings retreived from the previous step will be converted to .csv format. This spreadsheet would then be available to translators for translating (along with location and comments for each string, if any). For this, first the translate-toolkit will be used to study the required format of .csv file  and then using the xlwt library of python, the spreadsheet will be created.
     342) '''Building a spreadsheet for translators''' :- The strings retreived from the previous step will be converted to .csv format. This spreadsheet would then be available to translators for translating (along with location and comments for each string, if any). For this, first the translate-toolkit will be used to study the required format of .csv file  and then using the xlwt library of python, the spreadsheet will be created. The current web2py language file will be checked for existing translations. If any string is already translated, its translation will be fetched into the spreadsheet so that the translator need not translate it again. This also gives the translator an option to overwrite the existing translation with something more appropriate.
    3535
    36 3) '''Converting back the spreadsheet into web2py''' :- Once the translations are made, the .csv files contained the translations are to be merged back into web2py format. For this a couple of options will be available - i) Merge the new translations with existing ones ii) Replace the old .py file with the new one. Also, the translations may be present in several .csv files and so we need to merge all these files first before converting them into web2py format.
     363) '''Converting back the spreadsheet into web2py''' :- Once the translations are made, the .csv files contained the translations are to be merged back into web2py format. For this a couple of options will be available - i) Merge the new translations with existing ones ii) Replace the old .py file with the new one. Also, the translations may be present in several .csv files and so we need to merge all these files first before converting them into web2py format. 
    3737
    38 4) '''Updating strings due to modification of code''' :- There might be several changes made to the code from time to time and so we need to update the all_strings.txt accordingly. The frequency of update can be set manually. We need to consider two cases - when new strings are added and when some existing strings are deleted. Hence while updating we run step 1) as mentioned above. Then use the required *.py file and for each string in *.py we check for all its occurences in all_strings.txt. If none are found, then we remove the corresponding entry for *.py otherwise we set the flag corresponding to those strings(to indicate these are already translated). The above procedure ensures that those strings already translated earlier, are not selected again for translation. Hence, this completes the updation of strings and takes care of any modification of code.
     384) '''Updating strings due to modification of code''' :- There might be several changes made to the code from time to time and so we need to update the language file accordingly. The frequency of update can be set manually. We need to consider two cases - when new strings are added and when some existing strings are deleted. Hence while updating we run step 1) as mentioned above. The above procedure ensures that those strings already translated earlier, are not selected again for translation. Hence, this completes the updation of strings and takes care of any modification of code.
    3939
    40 5) '''Allow comments''' : We want to have comments as an optional parameter to the T(...) function such that it becomes T(<string> , <comments>). Hence we could create a new T(...) function and over-ride the inbuilt web2py T(...) function. This new T(...) function would contain most of the code from the inbuilt function except that it would allow to pass comments as parameter.
     405) '''Integrate the above functionality into an eden module''' :- The translation functionality described above is to be made an eden module so that it can be run from within eden. The current plan is to add this functionality into the "admin" module. Hence a translate controller is defined for taking input through forms and processing them. The code for 1) to 4) above will be moved to modules/s3/s3translate.py. The controller will then call the required methods from this file and display the result accordingly.
    4141
    42 6) '''GUI for tracking status''': The status of translations for each module must be available on a UI. This can be done by periodically reading the spreadsheet and checking for the percentage of untranslated strings.
     426) '''Allow comments''' : We want to have comments as an optional parameter to the T(...) function such that it becomes T(<string> , <comments>). Hence we could create a new T(...) function and over-ride the inbuilt web2py T(...) function. This new T(...) function would contain most of the code from the inbuilt function except that it would allow to pass comments as parameter.
     43
     447) '''GUI for tracking status''': The status of translations for each module must be available on a UI. This can be done by periodically reading the spreadsheet and checking for the percentage of untranslated strings.
    4345
    4446