Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.
Dashamir Hoxha edited this page Jul 21, 2013 · 2 revisions

Notes

1 Notes

1.1 How to create TAGS for Emacs

find . -type f | etags -
find . -type f \( -name "*.module" -o -name "*.install" -o -name "*.inc" \) | etags -a --language=php -

See: http://drupal.org/node/59868

1.2 Fine-Tuning MySQL Full-Text Search

http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

We want to index even short words and to disable stopword filtering.

  1. Edit /etc/mysql/my.cnf and set:
    [mysqld]
    ft_min_word_len = 1
    ft_stopword_file = ''
    
    [isamchk]
    ft_min_word_len = 1
    ft_stopword_file = ''
        
  2. Restart the server: service mysql restart
  3. Drop and recreate fulltext indexes.

1.3 How to use simple REST API for exporting projects

1.3.1 List:

wget --no-check-certificate -O list.txt https://l10n-sq.org/translations/project/list
cat list.txt
wget --no-check-certificate -O list.txt https://l10n-sq.org/translations/project/list/GNOME
wget --no-check-certificate -O list.txt https://l10n-sq.org/translations/project/list/GNOME/a*
wget --no-check-certificate -O list.txt https://l10n-sq.org/translations/project/list/*/kturtle
wget --no-check-certificate -O list.txt https://l10n-sq.org/translations/project/list/*/kturtle/json
wget --no-check-certificate -O list.txt https://l10n-sq.org/translations/project/list/*/-
wget --no-check-certificate -O list.txt https://l10n-sq.org/translations/project/list/*/*turtle*/text

1.3.2 Export:

wget --no-check-certificate -O test1.po https://l10n-sq.org/translations/project/export/KDE/kturtle/sq
vim test1.po

1.3.3 LibreOffice:

  • List:
    wget --no-check-certificate -O list.txt \
           https://l10n-sq.org/translations/project/list/LibreOffice
    cat list.txt
        
  • Export:
    wget --no-check-certificate -O LibreOffice-sw-fr.tgz \
           https://l10n-sq.org/translations/project/export_tgz/LibreOffice/sw/fr
    tar tvfz LibreOffice-sw-fr.tgz
    tar xfz LibreOffice-sw-fr.tgz
        
  • Export all the projects:
    wget --no-check-certificate -O LibreOffice-all-fr.tgz \
           https://l10n-sq.org/translations/project/export_tgz/LibreOffice/all/fr
    tar tvfz LibreOffice-all-fr.tgz
    tar xfz LibreOffice-all-fr.tgz
        

1.3.4 Mozilla:

  • List:
    wget --no-check-certificate -O list.txt \
           https://l10n-sq.org/translations/project/list/Mozilla
    cat list.txt
        
  • Export:
    wget --no-check-certificate -O Mozilla-browser-fr.tgz \
           https://l10n-sq.org/translations/project/export_tgz/Mozilla/browser/fr
    tar tvfz Mozilla-browser-fr.tgz
    tar xfz Mozilla-browser-fr.tgz
        
  • Export all the projects:
    wget --no-check-certificate -O Mozilla-all-fr.tgz \
           https://l10n-sq.org/translations/project/export_tgz/Mozilla/all/fr
    tar tvfz Mozilla-all-fr.tgz
    tar xfz Mozilla-all-fr.tgz
        

1.4 How to use simple REST API to get diffs

1.4.1 Get a list of diffs:

wget -q --no-check-certificate -O list.txt https://test.l10n-sq.org/translations/project/diff/Mozilla/browser/sq ; cat list.txt
wget -q --no-check-certificate -O list.txt https://test.l10n-sq.org/translations/project/diff/LibreOffice/sw/sq ; cat list.txt
wget -q --no-check-certificate -O list.txt https://test.l10n-sq.org/translations/project/diff/KDE/kdelibs/sq ; cat list.txt
wget -q --no-check-certificate -O list.txt https://test.l10n-sq.org/translations/project/diff/ubuntu/pingus/sq ; cat list.txt

1.4.2 Get a specific diff:

wget -q --no-check-certificate -O Mozilla-browser-sq.2.diff https://test.l10n-sq.org/translations/project/diff/Mozilla/browser/sq/2
wget -q --no-check-certificate -O Mozilla-browser-sq.2.ediff https://test.l10n-sq.org/translations/project/diff/Mozilla/browser/sq/2/ediff
wget -q --no-check-certificate -O LibreOffice-sw-sq.2.diff https://test.l10n-sq.org/translations/project/diff/LibreOffice/sw/sq/2
wget -q --no-check-certificate -O LibreOffice-sw-sq.2.ediff https://test.l10n-sq.org/translations/project/diff/LibreOffice/sw/sq/2/ediff
wget -q --no-check-certificate -O KDE-kdelibs-sq.2.diff https://test.l10n-sq.org/translations/project/diff/KDE/kdelibs/sq/2
wget -q --no-check-certificate -O KDE-kdelibs-sq.2.ediff https://test.l10n-sq.org/translations/project/diff/KDE/kdelibs/sq/2/ediff

1.4.3 Get the current diff:

This is the diff between the current state and the last snapshot. It is not stored yet in the DB (it will be stored if we get another snapshot).

wget -q --no-check-certificate -O Mozilla-browser-sq.current.diff https://test.l10n-sq.org/translations/project/diff/Mozilla/browser/sq/-
wget -q --no-check-certificate -O Mozilla-browser-sq.current.ediff https://test.l10n-sq.org/translations/project/diff/Mozilla/browser/sq/-/ediff
wget -q --no-check-certificate -O LibreOffice-sw-sq.current.diff https://test.l10n-sq.org/translations/project/diff/LibreOffice/sw/sq/-
wget -q --no-check-certificate -O LibreOffice-sw-sq.current.ediff https://test.l10n-sq.org/translations/project/diff/LibreOffice/sw/sq/-/ediff
wget -q --no-check-certificate -O KDE-kdelibs-sq.current.diff https://test.l10n-sq.org/translations/project/diff/KDE/kdelibs/sq/-
wget -q --no-check-certificate -O KDE-kdelibs-sq.current.ediff https://test.l10n-sq.org/translations/project/diff/KDE/kdelibs/sq/-/ediff

1.5 Misc

  • Field sguid:char(40) on strings, locations and translations must be of the same character set, otherwise mysql will not use the index (primary key) on queries. The same for the field tguid.
  • Crontab entry:
    0 4 * * *  wget -O - -q -t 1 --no-check-certificate https://test.l10n-sq.org/cron.php?cron_key=YVVQ7X8AmcbpDYEF_NGXISgbC-5z7_pOvxpjYEm2B_M