From b5a9db8598389c2c636fbb8d6a330b81bececd96 Mon Sep 17 00:00:00 2001 From: Kalpa Welivitigoda Date: Fri, 27 Sep 2013 18:20:15 +0000 Subject: fixed translations not working issue --- diff --git a/l10n_script.sh b/l10n_script.sh index 85c0b19..aedaedf 100755 --- a/l10n_script.sh +++ b/l10n_script.sh @@ -17,6 +17,12 @@ # usage: l10n_script.sh +LANGUAGE="$1" +SOURCE_DIR="source" +TRANSLATED_PO_PATH="translated_po/$LANGUAGE" +TRANSLATED_MO_PATH="source/translated/$LANGUAGE" + +# check whether a language is set as an argument if [ "$#" == "0" ]; then echo "No language provided" echo "Usage: ./l10n_script.sh " @@ -28,34 +34,35 @@ if [ ! -d "help" ]; then mkdir "help" fi -LANGUAGE="$1" -TRANSLATED_PO_PATH="translated_po/$LANGUAGE" -TRANSLATED_MO_PATH="source/translated/$LANGUAGE" - # create mo files if [ ! -d $TRANSLATED_PO_PATH ]; then echo "No PO files found for the language" exit 1 fi + +# check and create directories if [ ! -d $TRANSLATED_MO_PATH ]; then mkdir $TRANSLATED_MO_PATH fi if [ ! -d $TRANSLATED_MO_PATH/LC_MESSAGES ]; then mkdir $TRANSLATED_MO_PATH/LC_MESSAGES fi +if [ ! -d $TRANSLATED_MO_PATH/LC_MESSAGES/content ]; then + mkdir $TRANSLATED_MO_PATH/LC_MESSAGES/content +fi for file in $TRANSLATED_PO_PATH/*.po do # remove the prefix numbers and build the mo files mo_file=$(basename $(echo "$file" | sed 's/\.po/\.mo/') | sed 's/^[0-9]*_//') - msgfmt "$file" -o $TRANSLATED_MO_PATH/LC_MESSAGES/"$mo_file" + msgfmt "$file" -o $TRANSLATED_MO_PATH/LC_MESSAGES/content/"$mo_file" done # build html if [ ! -d help/$LANGUAGE ]; then mkdir help/$LANGUAGE fi -sphinx-build -b html -Dlanguage=$LANGUAGE source help/$LANGUAGE +sphinx-build -b html -Dlanguage=$LANGUAGE $SOURCE_DIR help/$LANGUAGE # move images and static content and remove sources rm -rf help/_images help/_static @@ -63,9 +70,6 @@ mv help/$LANGUAGE/_images help/ mv help/$LANGUAGE/_static help/ rm -r help/$LANGUAGE/_sources -# replacing staic content links -for file in help/$LANGUAGE/*.html -do - echo $file - sed -i 's/_images/..\/_images/g;s/_static/..\/_static/g' "$file" -done +# move html files to the root on the language directory +mv help/$LANGUAGE/content/*.html help/$LANGUAGE/ +rmdir help/$LANGUAGE/content diff --git a/source/conf.py b/source/conf.py index 4e7518c..812e664 100644 --- a/source/conf.py +++ b/source/conf.py @@ -37,7 +37,7 @@ source_suffix = '.rst' #source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = 'content/index' # General information about the project. project = u'Sugar' @@ -54,8 +54,8 @@ release = '0.94' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None -locale_dirs=["translated/"] +locale_dirs=['translated/'] +gettext_compact=False # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/source/content/index.rst b/source/content/index.rst new file mode 100644 index 0000000..50761fb --- /dev/null +++ b/source/content/index.rst @@ -0,0 +1,101 @@ +.. Sugar documentation master file, created by + sphinx-quickstart on Thu Apr 18 12:17:36 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Sugar's documentation! +================================= + +Contents: + + +Introduction + +.. toctree:: + :maxdepth: 1 + + about.rst + about_olpc.rst + about_sugar.rst + how_to_volunteer.rst + credits_copyright.rst + +Hardware + +.. toctree:: + :maxdepth: 1 + + getting_started.rst + opening_the_xo.rst + starting_the_xo.rst + ports.rst + keyboard.rst + maintaining.rst + battery.rst + repair.rst + hardware_evolution.rst + +Software + +.. toctree:: + :maxdepth: 1 + + sugar_ui.rst + home_view.rst + neighborhood_view.rst + group_view.rst + frame.rst + journal.rst + my_settings.rst + gnome.rst + schoolserver.rst + +Activities + +.. toctree:: + :maxdepth: 1 + + what_is_an_activity.rst + launching_activities.rst + switching_activities.rst + collaborating.rst + exiting_activities.rst + browse.rst + calculate.rst + chat.rst + fototoon.rst + measure.rst + memorize.rst + paint.rst + pippy.rst + portfolio.rst + read.rst + record.rst + terminal.rst + tamtammini.rst + turtleart.rst + write.rst + +Network + +.. toctree:: + :maxdepth: 1 + + give_me_the_internet.rst + getting_connected.rst + troubleshooting_connectivity.rst + +Support + +.. toctree:: + :maxdepth: 1 + + upgrade_all.rst + getting_support.rst + +Appendices + +.. toctree:: + :maxdepth: 1 + + glossary.rst diff --git a/source/index.rst b/source/index.rst deleted file mode 100644 index e9d5e8a..0000000 --- a/source/index.rst +++ /dev/null @@ -1,101 +0,0 @@ -.. Sugar documentation master file, created by - sphinx-quickstart on Thu Apr 18 12:17:36 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to Sugar's documentation! -================================= - -Contents: - - -Introduction - -.. toctree:: - :maxdepth: 1 - - content/about.rst - content/about_olpc.rst - content/about_sugar.rst - content/how_to_volunteer.rst - content/credits_copyright.rst - -Hardware - -.. toctree:: - :maxdepth: 1 - - content/getting_started.rst - content/opening_the_xo.rst - content/starting_the_xo.rst - content/ports.rst - content/keyboard.rst - content/maintaining.rst - content/battery.rst - content/repair.rst - content/hardware_evolution.rst - -Software - -.. toctree:: - :maxdepth: 1 - - content/sugar_ui.rst - content/home_view.rst - content/neighborhood_view.rst - content/group_view.rst - content/frame.rst - content/journal.rst - content/my_settings.rst - content/gnome.rst - content/schoolserver.rst - -Activities - -.. toctree:: - :maxdepth: 1 - - content/what_is_an_activity.rst - content/launching_activities.rst - content/switching_activities.rst - content/collaborating.rst - content/exiting_activities.rst - content/browse.rst - content/calculate.rst - content/chat.rst - content/fototoon.rst - content/measure.rst - content/memorize.rst - content/paint.rst - content/pippy.rst - content/portfolio.rst - content/read.rst - content/record.rst - content/terminal.rst - content/tamtammini.rst - content/turtleart.rst - content/write.rst - -Network - -.. toctree:: - :maxdepth: 1 - - content/give_me_the_internet.rst - content/getting_connected.rst - content/troubleshooting_connectivity.rst - -Support - -.. toctree:: - :maxdepth: 1 - - content/upgrade_all.rst - content/getting_support.rst - -Appendices - -.. toctree:: - :maxdepth: 1 - - content/glossary.rst diff --git a/test.html b/test.html deleted file mode 100644 index c86895c..0000000 --- a/test.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - - - -
- - -

Introduction

-
-

System Message: ERROR/3 (index.rst, line 4)

-

Unknown directive type "toctree".

-
-.. toctree::
-    :maxdepth: 1
-
-    about.rst
-    about_olpc.rst
-    about_sugar.rst
-    how_to_volunteer.rst
-
-
-
-

Hardware

-
-

System Message: ERROR/3 (index.rst, line 14)

-

Unknown directive type "toctree".

-
-.. toctree::
-    :maxdepth: 1
-
-    getting_started.rst
-    opening_the_xo.rst
-    starting_the_xo.rst
-    ports.rst
-    keyboard.rst
-    maintaining.rst
-    battery.rst
-    repair.rst
-    hardware_evolution.rst
-
-
-
-

Software

-
-

System Message: ERROR/3 (index.rst, line 29)

-

Unknown directive type "toctree".

-
-.. toctree::
-    :maxdepth: 1
-
-    home_view.rst
-    neighborhood_view.rst
-    group_view.rst
-    frame.rst
-    journal.rst
-    my_settings.rst
-    gnome.rst
-    schoolserver.rst
-
-
-
-

Activities

-
-

System Message: ERROR/3 (index.rst, line 43)

-

Unknown directive type "toctree".

-
-.. toctree::
-    :maxdepth: 1
-
-    what_is_an_activity.rst
-    launching_activities.rst
-    switching_activities.rst
-    collaborating.rst
-    browse.rst
-    calculate.rst
-    exiting_activities.rst
-    chat.rst
-    fototoon.rst
-    measure.rst
-    memorize.rst
-    paint.rst
-    pippy.rst
-    portfolio.rst
-    read.rst
-    terminal.rst
-    tamtammini.rst
-    turtleart.rst
-    write.rst
-
-
-
-

Network

-
-

System Message: ERROR/3 (index.rst, line 68)

-

Unknown directive type "toctree".

-
-.. toctree::
-    :maxdepth: 1
-
-    give_me_the_internet.rst
-    getting_connected.rst
-    troubleshooting_connectivity.rst
-
-
-
-

Support

-
-

System Message: ERROR/3 (index.rst, line 77)

-

Unknown directive type "toctree".

-
-.. toctree::
-    :maxdepth: 1
-
-    upgrade_all.rst
-    getting_support.rst
-
-
-
-

Appendices

-
-

System Message: ERROR/3 (index.rst, line 85)

-

Unknown directive type "toctree".

-
-.. toctree::
-    :maxdepth: 1
-
-    glossary.rst
-
-
-
-
- - -- cgit v0.9.1