diff --git a/.gitignore b/.gitignore index f3eb56f..0ca971c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__ secret-key.txt portal-env *.swp +*.mo static/* logs/* db diff --git a/Dockerfile b/Dockerfile index f3925c9..e491d86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,9 +24,7 @@ ENV DB_PORT="5432" EXPOSE 80 -CMD ["uwsgi", "--socket", "0.0.0.0:3000", \ - "--protocol", "uwsgi", \ - "--module", "dtekportal.wsgi"] +CMD python3 manage.py migrate && python3 manage.py compilemessages && uwsgi --socket 0.0.0.0:3000 --protocol uwsgi --module dtekportal.wsgi #CMD /scripts/wait-for-it.sh "$DB_HOST:$DB_PORT" -- \ # uwsgi --http-socket ":$PORT" --module dtekportal.wsgi diff --git a/Makefile b/Makefile index 688d77f..f75448e 100644 --- a/Makefile +++ b/Makefile @@ -5,30 +5,21 @@ export $(shell sed 's/=.*//' .env) test: env -up-prod: - sudo -E docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d - sudo -E docker-compose exec web /bin/sh -c "python3 manage.py migrate" - sudo -E docker-compose exec web /bin/sh -c "python3 manage.py compilemessages -l en" - sudo -E docker-compose exec web /bin/sh -c "python3 manage.py collectstatic --noinput" - up-develop: # sleep 5 && sudo docker-compose exec web /bin/sh -c "python3 manage.py migrate" & - sudo -E docker-compose run web /bin/sh -c "python3 manage.py compilemessages -l en" - sudo -E docker-compose -f docker-compose.yml -f docker-compose.develop.yml up + docker compose run web /bin/sh -c "python3 manage.py compilemessages -l en" + docker compose -f docker-compose.yml -f docker-compose.develop.yml up makemessages: - sudo -E docker-compose run web python3 manage.py makemessages -l en - -# Use when the container is running -makemessages-exec: - sudo -E docker-compose exec web python3 manage.py makemessages -l en + docker compose exec web python3 manage.py makemessages -a + docker compose cp web:/locale . compilemessages: - sudo -E docker-compose exec web python3 manage.py compilemessages -l en - + docker compose cp ./locale web:. + docker compose exec web python3 manage.py compilemessages build: - sudo -E docker-compose build + docker compose build down: - sudo -E docker-compose down + docker compose down diff --git a/README.md b/README.md index 43cea93..360435e 100644 --- a/README.md +++ b/README.md @@ -162,5 +162,6 @@ parameter in the url as defined in `urls.py`. The website is written with Swedish as its original language. In order to make a string translatable, it must be wrapped in a function. For details on how to do this in pyton code and template code respectively, see the [Django docs on translation](https://docs.djangoproject.com/en/2.1/topics/i18n/translation/). -The mapping from Swedish to English lives in `locale/en/LC_MESSAGES/django.po -`. When you have edited a file and added strings that need to be created, run `make makemessages`. This will update the .po file to contain the new strings, whose translation can now be filled in. For the website to update, you need to compile the .po file. This can be done by running `make compilemessages`. If this does not work, try stopping the container using `make down` and starting it up again; the makefile is configured to compile the messages as the container starts. +The mapping from Swedish to English lives in `locale/en/LC_MESSAGES/django.po`. When you have edited a file and added strings that need to be created, run `make makemessages`. This will update the .po file to contain the new strings, whose translations can now be filled in. Any translation strings that have been marked as "fuzzy" will be ignored by Django, so make sure to clean those up before finishing. + +For the website to update, you need to compile the .po file. This can be done by running `make compilemessages`. If this does not work, try stopping the container using `make down` and starting it up again; the makefile is configured to compile the messages as the container starts. diff --git a/docker-compose.develop.yml b/docker-compose.develop.yml index 8bc1ee5..ea93f3a 100644 --- a/docker-compose.develop.yml +++ b/docker-compose.develop.yml @@ -3,8 +3,11 @@ version: '3.7' services: web: # use wait for it script to make sure db is ready before launching - command: ["/scripts/wait-for-it.sh", "db:5432", "--", "python", "manage.py", "runserver", "0.0.0.0:8000"] + command: ["/scripts/boot.sh"] + ports: + - "8000:8000" volumes: - ./dtekportal:/code + - ./scripts:/scripts environment: - DJANGO_DEBUG=1 diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo deleted file mode 100644 index 6b25439..0000000 Binary files a/locale/en/LC_MESSAGES/django.mo and /dev/null differ diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 51678c5..aae659a 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-26 19:34+0200\n" +"POT-Creation-Date: 2024-09-04 21:03+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -30,11 +30,11 @@ msgstr "The divison on Facebook" msgid "Mat på Campus:" msgstr "Food on campus:" -#: homepage/templates/homepage/index/welcome-box.html:10 +#: homepage/templates/homepage/index/welcome-box.html:11 msgid "Välkommen" msgstr "Welcome" -#: homepage/templates/homepage/index/welcome-box.html:14 +#: homepage/templates/homepage/index/welcome-box.html:15 msgid "" "Detta är DTEK-portalen, med ett gäng nyttiga länkar till ställen där du kan " "tänkas vilja gå." @@ -42,17 +42,17 @@ msgstr "" "This is the DTEK portal, containing a bunch of useful links to places you " "might want to go." -#: homepage/templates/homepage/index/welcome-box.html:16 +#: homepage/templates/homepage/index/welcome-box.html:17 msgid "" "Datateknologsektionen är en icke vinstdrivande organisation som är till för " "alla studenter på civilingenjörsprogrammet Datateknik på Chalmers och dess " -"relaterade masterprogram. Vi ordnar mottagning för nyantagna, arrangerar fester, " -"bedriver studiebevakning och mycket mer." +"relaterade masterprogram. Vi ordnar mottagning för nyantagna, " +"arrangerar fester, bedriver studiebevakning och mycket mer." msgstr "" "The Student Division of Computer Science and Engineering,"Data" " "(officially "Datateknologsektionen" in Swedish),is a nonprofit " @@ -61,12 +61,13 @@ msgstr "" "Masterprogram\">master's programmes. We arrange receptions for " "newlyadmitted students at both the bachelor's and master's programmes, arrange parties, monitor your education " -"and much more." +"dtek.se/wiki/Main/DMNollK\">master's programmes, arrange parties, monitor your " +"education and much more." -#: homepage/templates/homepage/index/welcome-box.html:18 +#: homepage/templates/homepage/index/welcome-box.html:19 msgid "" "En del av Chalmers Studentkår " msgstr "" @@ -87,9 +88,9 @@ msgid "" "dHack \">dHack med URL-en och förklara vad du förväntade " "dig att hitta där." msgstr "" -"If you think there's an error behind the scenes, please contact \">dHack with the URL and explain what you " -"were expecting to see." +"If you think there's an error behind the scenes, please contact \">dHack with the URL and explain " +"what you were expecting to see." #: templates/footer/footer-foot.html:8 msgid "Utvecklad av " @@ -210,7 +211,7 @@ msgstr "Master Reception Committee" msgid "Matlagningskommitté" msgstr "Cooking Committee" -#: templates/footer/footer-right-col.html:142 +#: templates/footer/footer-right-col.html:144 msgid "Jämlikhetskommitté" msgstr "Equality Committee" @@ -326,45 +327,3 @@ msgstr "Studies" #: templates/top-nav-banner.html:23 msgid "Foton" msgstr "Photos" - -#~ msgid "Dbrus" -#~ msgstr "DBrus" - -#~ msgid "PingPong" -#~ msgstr "PingPong" - -#~ msgid "Chalmers Tekniska Högskola" -#~ msgstr "Chalmers University of Technology" - -#~ msgid "en del av Chalmers Studentkår" -#~ msgstr "part of Chalmers Student Union" - -#~ msgid "Jobb" -#~ msgstr "Jobs" - -#~ msgid "Twitter" -#~ msgstr "Twitter" - -#~ msgid "Twitter!" -#~ msgstr "Twitter!" - -#~ msgid "Reddit" -#~ msgstr "Reddit" - -#~ msgid "Schysst subreddit med stor potential" -#~ msgstr "Cool subreddit with huge potential" - -#~ msgid "Cremona" -#~ msgstr "Cremona" - -#~ msgid "Cremona bokhandel, numera kallat Store" -#~ msgstr "Cremona bookstore, now called Store" - -#~ msgid "IRC" -#~ msgstr "IRC" - -#~ msgid "Slack, fast utan GUI. För äkta Datateknologer!" -#~ msgstr "Slack, but without the GUI. For real computer geeks!" - -#~ msgid "Datateknologsektionen Full Title" -#~ msgstr "Student Division of Computer Science and Engineering" diff --git a/locale/sv/LC_MESSAGES/django.po b/locale/sv/LC_MESSAGES/django.po new file mode 100644 index 0000000..ed3e476 --- /dev/null +++ b/locale/sv/LC_MESSAGES/django.po @@ -0,0 +1,327 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-04 21:03+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: homepage/templates/homepage/index/cal-box.html:5 +msgid "Arrangemangskalender" +msgstr "Arrangemangskalender" + +#: homepage/templates/homepage/index/fb-box.html:5 +msgid "Sektionen på Facebook" +msgstr "Sektionen på Facebook" + +#: homepage/templates/homepage/index/food-box.html:5 +msgid "Mat på Campus:" +msgstr "Mat på Campus:" + +#: homepage/templates/homepage/index/welcome-box.html:11 +msgid "Välkommen" +msgstr "Välkommen" + +#: homepage/templates/homepage/index/welcome-box.html:15 +msgid "" +"Detta är DTEK-portalen, med ett gäng nyttiga länkar till ställen där du kan " +"tänkas vilja gå." +msgstr "" +"Detta är DTEK-portalen, med ett gäng nyttiga länkar till ställen där du kan " +"tänkas vilja gå." + +#: homepage/templates/homepage/index/welcome-box.html:17 +msgid "" +"Datateknologsektionen är en icke vinstdrivande organisation som är till för " +"alla studenter på civilingenjörsprogrammet Datateknik på Chalmers och dess " +"relaterade masterprogram. Vi ordnar mottagning för nyantagna, " +"arrangerar fester, bedriver studiebevakning och mycket mer." +msgstr "" +"Datateknologsektionen är en icke vinstdrivande organisation som är till för " +"alla studenter på civilingenjörsprogrammet Datateknik på Chalmers och dess " +"relaterade masterprogram. Vi ordnar mottagning för nyantagna, " +"arrangerar fester, bedriver studiebevakning och mycket mer." + +#: homepage/templates/homepage/index/welcome-box.html:19 +msgid "" +"En del av Chalmers Studentkår " +msgstr "" +"En del av Chalmers Studentkår " + +#: templates/404.html:36 +msgid "Den gubben gick inte!" +msgstr "Den gubben gick inte!" + +#: templates/404.html:38 +msgid "Det här är en typisk 404-sida." +msgstr "Det här är en typisk 404-sida." + +#: templates/404.html:39 +msgid "" +"Om du tror det beror på ett tekniskt fel, vänligen kontakta \">dHack med URL-en och förklara vad du förväntade " +"dig att hitta där." +msgstr "" +"Om du tror det beror på ett tekniskt fel, vänligen kontakta \">dHack med URL-en och förklara vad du förväntade " +"dig att hitta där." + +#: templates/footer/footer-foot.html:8 +msgid "Utvecklad av " +msgstr "Utvecklad av " + +#: templates/footer/footer-foot.html:8 +msgid "stulen av" +msgstr "stulen av" + +#: templates/footer/footer-foot.html:8 +msgid "översatt av" +msgstr "översatt av" + +#: templates/footer/footer-foot.html:8 +msgid "omskriven av" +msgstr "omskriven av" + +#: templates/footer/footer-foot.html:8 +msgid "mer info" +msgstr "mer info" + +#: templates/footer/footer-foot.html:9 +msgid "licens" +msgstr "licens" + +#: templates/footer/footer-foot.html:10 +msgid "de flesta foton tillhör" +msgstr "de flesta foton tillhör" + +#: templates/footer/footer-left-col.html:13 +msgctxt "full title" +msgid "Datateknologsektionen" +msgstr "Datateknologsektionen" + +#: templates/footer/footer-left-col.html:14 +#: templates/header/header-left-box.html:13 templates/top-nav-banner.html:16 +msgid "Chalmers Studentkår" +msgstr "Chalmers Studentkår" + +#: templates/footer/footer-middle-col.html:9 +msgid "Kontakt" +msgstr "Kontakt" + +#: templates/footer/footer-middle-col.html:17 +msgid "Postadress" +msgstr "Postadress" + +#: templates/footer/footer-middle-col.html:31 +msgid "Organisationsnummer" +msgstr "Organisationsnummer" + +#: templates/footer/footer-right-col.html:8 +msgid "Styrelse" +msgstr "Styrelse" + +#: templates/footer/footer-right-col.html:16 +msgid "Studienämnd" +msgstr "Studienämnd" + +#: templates/footer/footer-right-col.html:24 +msgid "Sexmästeri" +msgstr "Sexmästeri" + +#: templates/footer/footer-right-col.html:32 +msgid "PR-kommitté" +msgstr "PR-kommitté" + +#: templates/footer/footer-right-col.html:40 +msgid "Rustmästeri" +msgstr "Rustmästeri" + +#: templates/footer/footer-right-col.html:48 +msgid "Mottagningskommitté" +msgstr "Mottagningskommitté" + +#: templates/footer/footer-right-col.html:56 +#: templates/header/header-menu-box.html:40 +msgid "Arbetsmarknadsgrupp" +msgstr "Arbetsmarknadsgrupp" + +#: templates/footer/footer-right-col.html:64 +msgid "DATA-driftsförening" +msgstr "DATA-driftsförening" + +#: templates/footer/footer-right-col.html:72 +msgid "Fanbärare" +msgstr "Fanbärare" + +#: templates/footer/footer-right-col.html:80 +msgid "Idrottsförening" +msgstr "Idrottsförening" + +#: templates/footer/footer-right-col.html:88 +msgid "Spelförening" +msgstr "Spelförening" + +#: templates/footer/footer-right-col.html:96 +msgid "Fotokommitté" +msgstr "Fotokommitté" + +#: templates/footer/footer-right-col.html:104 +msgid "Bilkommitté" +msgstr "Bilkommitté" + +#: templates/footer/footer-right-col.html:112 +msgid "Sektionstidning" +msgstr "Sektionstidning" + +#: templates/footer/footer-right-col.html:120 +msgid "Sektionens podcast" +msgstr "Sektionens podcast" + +#: templates/footer/footer-right-col.html:128 +msgid "Master Reception Committee" +msgstr "Master Reception Committee" + +#: templates/footer/footer-right-col.html:136 +msgid "Matlagningskommitté" +msgstr "Matlagningskommitté" + +#: templates/footer/footer-right-col.html:144 +msgid "Jämlikhetskommitté" +msgstr "Jämlikhetskommitté" + +#: templates/head.html:14 +msgid "Datateknologsektionen på Chalmers" +msgstr "Datateknologsektionen på Chalmers" + +#: templates/header/header-left-box.html:11 +msgid "Teknologsektionen" +msgstr "Teknologsektionen" + +#: templates/header/header-left-box.html:12 +msgid "Datateknik" +msgstr "Datateknik" + +#: templates/header/header-menu-box.html:34 templates/top-nav-banner.html:24 +msgid "Företag" +msgstr "Företag" + +#: templates/header/header-menu-box.html:50 +msgid "Wikin" +msgstr "Wikin" + +#: templates/header/header-menu-box.html:56 +msgid "DTEK-wikin, där allt kul händer!" +msgstr "DTEK-wikin, där allt kul händer!" + +#: templates/header/header-menu-box.html:66 +#: templates/header/header-menu-box.html:72 +msgid "Styrdokument" +msgstr "Styrdokument" + +#: templates/header/header-menu-box.html:82 +msgid "Databussen" +msgstr "Databussen" + +#: templates/header/header-menu-box.html:88 +msgid "Mer info om Databussen" +msgstr "Mer info om Databussen" + +#: templates/header/header-menu-box.html:98 +msgid "Schema" +msgstr "Schema" + +#: templates/header/header-menu-box.html:104 +msgid "TimeEdit" +msgstr "TimeEdit" + +#: templates/header/header-menu-box.html:114 +msgid "Grupprum" +msgstr "Grupprum" + +#: templates/header/header-menu-box.html:120 +msgid "Boka grupprum på Chalmers" +msgstr "Boka grupprum på Chalmers" + +#: templates/header/header-menu-box.html:130 +msgid "Kårkort" +msgstr "Kårkort" + +#: templates/header/header-menu-box.html:136 +msgid "Genväg för att ladda ditt kårkort" +msgstr "Genväg för att ladda ditt kårkort" + +#: templates/header/header-menu-box.html:146 +msgid "Karta" +msgstr "Karta" + +#: templates/header/header-menu-box.html:152 +msgid "Karta över Campus" +msgstr "Karta över Campus" + +#: templates/header/header-menu-box.html:162 +msgid "Veckobrev" +msgstr "Veckobrev" + +#: templates/header/header-menu-box.html:166 +msgid "" +"Anmäl dig till datas veckobrev, med alla arrangemang och annat som händer på " +"sektionen" +msgstr "" +"Anmäl dig till datas veckobrev, med alla arrangemang och annat som händer på " +"sektionen" + +#: templates/header/header-menu-box.html:174 +msgid "Studiesocial hjälp" +msgstr "Studiesocial hjälp" + +#: templates/header/header-menu-box.html:178 +msgid "" +"Om du känner att studierna går tufft,\n" +" du känner dig nere, känner dig kränkt eller " +"diskriminerad,\n" +" eller känner dig osäker finns epost och telefonnummer " +"att ringa här" +msgstr "" +"Om du känner att studierna går tufft,\n" +" du känner dig nere, känner dig kränkt eller " +"diskriminerad,\n" +" eller känner dig osäker finns epost och telefonnummer " +"att ringa här" + +#: templates/top-nav-banner.html:15 +msgid "Datateknologsektionen" +msgstr "Datateknologsektionen" + +#: templates/top-nav-banner.html:21 +msgid "Mottagning" +msgstr "Mottagning" + +#: templates/top-nav-banner.html:22 +msgid "Studier" +msgstr "Studier" + +#: templates/top-nav-banner.html:23 +msgid "Foton" +msgstr "Foton" diff --git a/scripts/boot.sh b/scripts/boot.sh new file mode 100755 index 0000000..78aeec1 --- /dev/null +++ b/scripts/boot.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +python3 manage.py migrate +python3 manage.py compilemessages +exec /scripts/wait-for-it.sh db:5432 -- python manage.py runserver 0.0.0.0:8000