From 272046729bb4b9857ae25dc606ebb6926bb53840 Mon Sep 17 00:00:00 2001 From: MikaelKrats <mikael.krats@gmail.com> Date: Wed, 22 Feb 2023 03:17:23 +0200 Subject: [PATCH] small fixes to localization --- src/tjts5901/templates/addItem.html | 2 +- src/tjts5901/templates/auth/login.html | 13 +-- src/tjts5901/templates/auth/profile.html | 4 +- src/tjts5901/templates/auth/register.html | 2 +- src/tjts5901/templates/auth/tokens.html | 4 +- src/tjts5901/templates/listBid.html | 4 +- .../fi_FI/LC_MESSAGES/messages.po | 97 ++++++++++++++++--- src/tjts5901/views.py | 2 +- 8 files changed, 96 insertions(+), 32 deletions(-) diff --git a/src/tjts5901/templates/addItem.html b/src/tjts5901/templates/addItem.html index 826728a9..1ee60072 100644 --- a/src/tjts5901/templates/addItem.html +++ b/src/tjts5901/templates/addItem.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block header %} -<h1>{% block title %}Sell items{% endblock %}</h1> +<h1>{% block title %}{{_("Sell items")}}{% endblock %}</h1> {% endblock %} {% block content %} diff --git a/src/tjts5901/templates/auth/login.html b/src/tjts5901/templates/auth/login.html index 512f2275..b8e1c241 100644 --- a/src/tjts5901/templates/auth/login.html +++ b/src/tjts5901/templates/auth/login.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block header %} - <h1>{% block title %}Log In{% endblock %}</h1> + <h1>{% block title %}{{_("Log In")}}{% endblock %}</h1> {% endblock %} {% block content %} @@ -12,7 +12,7 @@ <div class="col-12 d-flex align-items-center justify-content-center"> <div class="card card-tertiary w-100 fmxw-400"> <div class="card-header text-center"> - <span>Sign in to our platform</span> + <span>{{_("Sign in to our platform")}}</span> </div> <div class="login-dialog-img"></div> <div class="card-body"> @@ -31,24 +31,19 @@ <input name="password" id="password" type="password" class="form-control" placeholder="Your password" required=""> </div> - <div class="d-flex justify-content-between align-items-center mb-4"> <div class="form-check"> <label class="form-check-label"> - <input name="remember-me" class="form-check-input" type="checkbox"> - <span class="form-check-x"></span> - <span class="form-check-sign"></span> - Remember me + <!-- Functionality not yet impelemented --> </label> </div> - <p class="m-0"><a href="#" class="text-right">{{ _("Lost password?") }}</a></p> </div> </div> <button type="submit" class="btn btn-block btn-primary">{{ _("Login") }}</button> </form> <div class="d-block d-sm-flex justify-content-center align-items-center mt-4"> <p class="font-weight-normal"> - Not registered? + {{_("Not registered?")}} <a href="{{ url_for('auth.register') }}" class="font-weight-bold">{{ _("Create an account") }}</a> </p> </div> diff --git a/src/tjts5901/templates/auth/profile.html b/src/tjts5901/templates/auth/profile.html index 1f3ba057..f9a4fd8e 100644 --- a/src/tjts5901/templates/auth/profile.html +++ b/src/tjts5901/templates/auth/profile.html @@ -2,7 +2,7 @@ {% block header %} <div class="container"> - <h1>{% block title %}{{user.email}}'s Profile Page{% endblock %}</h1> + <h1>{% block title %} {{user.email}} {{_("'s Profile Page") }}{% endblock %}</h1> </div> {% endblock %} @@ -42,7 +42,7 @@ <div class="row"> <div class="col-sm-3"></div> <div class="col-sm-6 auction-section"> - <h3>Recent Auctions</h3> + <h3>{{_("Recent Auctions")}}</h3> <div class="card-deck"> {% for auction in items %} <div class="card"> diff --git a/src/tjts5901/templates/auth/register.html b/src/tjts5901/templates/auth/register.html index 1b586d44..d4523483 100644 --- a/src/tjts5901/templates/auth/register.html +++ b/src/tjts5901/templates/auth/register.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block header %} - <h1>{% block title %}Register{% endblock %}</h1> + <h1>{% block title %}{{_("Register")}}{% endblock %}</h1> {% endblock %} <style> .login-dialog-img { diff --git a/src/tjts5901/templates/auth/tokens.html b/src/tjts5901/templates/auth/tokens.html index 0f1391b2..b82494bb 100644 --- a/src/tjts5901/templates/auth/tokens.html +++ b/src/tjts5901/templates/auth/tokens.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block header %} - <h1>{% block title %}Access tokens{% endblock %}</h1> + <h1>{% block title %}{{_("Access tokens")}}{% endblock %}</h1> {% endblock %} {% block content %} @@ -61,7 +61,7 @@ <div class="container"> <div class="row"> <div class="col-md-8 offset-md-4"> - <h2 class="text-center mb-4">{{ ("Active Access Tokens") }}</h2> + <h2 class="text-center mb-4">{{ _("Active Access Tokens") }}</h2> <table class="table table-striped"> <thead> <tr> diff --git a/src/tjts5901/templates/listBid.html b/src/tjts5901/templates/listBid.html index 4840d9c4..fe7e4051 100644 --- a/src/tjts5901/templates/listBid.html +++ b/src/tjts5901/templates/listBid.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block header %} - <h1>{% block title %}View all items currently on auction {% endblock %}</h1> + <h1>{% block title %}{{_("View all items currently on auction")}} {% endblock %}</h1> {% endblock %} {% block content %} @@ -22,7 +22,7 @@ </div> <p class="mb-1">{{ item.description }}</p> <small>{{ item.current_price|localcurrency}}</small> - <a href="{{ url_for('views.page_bid', id=item.id) }}"><button class="btn btn-primary">Bid</button></a> + <a href="{{ url_for('views.page_bid', id=item.id) }}"><button class="btn btn-primary">{{_("Bid")}}</button></a> </div> <div class="row justify-content-md-center"> <div class="col-md-auto"> diff --git a/src/tjts5901/translations/fi_FI/LC_MESSAGES/messages.po b/src/tjts5901/translations/fi_FI/LC_MESSAGES/messages.po index addc2631..54a213c0 100644 --- a/src/tjts5901/translations/fi_FI/LC_MESSAGES/messages.po +++ b/src/tjts5901/translations/fi_FI/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-02-21 21:18+0000\n" +"POT-Creation-Date: 2023-02-21 23:22+0000\n" "PO-Revision-Date: 2023-02-21 21:18+0000\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language: fi_FI\n" @@ -78,7 +78,7 @@ msgstr "Poistettu tunniste" #: src/tjts5901/views.py:114 msgid "The auction of your item '{}' has ended. " -msgstr "Esineesi '{}' huutokauppa on loppunut. " +msgstr "Esineesi \\'{}'\\ huutokauppa on loppunut. " #: src/tjts5901/views.py:117 msgid "Congrats! It was sold for {}." @@ -96,7 +96,9 @@ msgstr "Onnittelut! Voitit huutokaupan esineestä '{}' huudollasi" msgid "" "Pity! You were not successfull with the auction of '{}' with your bid " "over {} €." -msgstr "Harmi! Et ollut voittanut huutokauppaa esineesä '{}' huudollasi over yli {}" +msgstr "" +"Harmi! Et ollut voittanut huutokauppaa esineesä '{}' huudollasi over yli " +"{}" #: src/tjts5901/views.py:185 #, python-format @@ -129,6 +131,10 @@ msgstr "Virhe asettaessa huutoa: %(exc)s" msgid "Bid placed successfully!" msgstr "Huuto asetettiin onnistuneesti" +#: src/tjts5901/templates/addItem.html:4 +msgid "Sell items" +msgstr "Myy esineitä" + #: src/tjts5901/templates/addItem.html:18 msgid "Item's name" msgstr "Esineen nimi" @@ -173,19 +179,47 @@ msgstr "Minun profiilini" msgid "Log Out" msgstr "Kirjaudu ulos" +#: src/tjts5901/templates/auth/register.html:4 #: src/tjts5901/templates/base.html:42 msgid "Register" msgstr "Rekisteröidy" -#: src/tjts5901/templates/base.html:43 +#: src/tjts5901/templates/auth/login.html:4 src/tjts5901/templates/base.html:43 msgid "Log In" msgstr "Kirjaudu sisään" +#: src/tjts5901/templates/listBid.html:4 +msgid "View all items currently on auction" +msgstr "Katsele kaikki tarjolla olevia esineitä" + +#: src/tjts5901/templates/listBid.html:25 +msgid "Bid" +msgstr "Huuda" + +#: src/tjts5901/templates/view.html:20 +#, fuzzy +msgid "Created : " +msgstr "Luotu" + +#: src/tjts5901/templates/view.html:21 +#, fuzzy +msgid "Current bid : " +msgstr "Nykyinen hinta" + +#: src/tjts5901/templates/view.html:24 +msgid "Validate" +msgstr "Vahvista" + #: src/tjts5901/templates/view.html:27 #, python-format msgid "Minimum bid is %(min_bid)s" msgstr "Minimi huuto on %(min_bid)s" +#: src/tjts5901/templates/auth/login.html:15 +#, fuzzy +msgid "Sign in to our platform" +msgstr "Kirjaudu sisään järjestelmäämme" + #: src/tjts5901/templates/auth/login.html:22 #: src/tjts5901/templates/auth/register.html:30 msgid "Email" @@ -196,25 +230,34 @@ msgstr "Sähköpostiosoite" msgid "Password" msgstr "Salasana" -#: src/tjts5901/templates/auth/login.html:44 -msgid "Lost password?" -msgstr "Hukkasitko salasanasi?" - -#: src/tjts5901/templates/auth/login.html:47 +#: src/tjts5901/templates/auth/login.html:42 msgid "Login" msgstr "Kirjaudu sisään" -#: src/tjts5901/templates/auth/login.html:52 +#: src/tjts5901/templates/auth/login.html:46 +#, fuzzy +msgid "Not registered?" +msgstr "Rekisteröidy" + +#: src/tjts5901/templates/auth/login.html:47 msgid "Create an account" msgstr "Luo käyttäjä" +#: src/tjts5901/templates/auth/profile.html:5 +msgid "'s Profile Page" +msgstr "Profiili sivu" + #: src/tjts5901/templates/auth/profile.html:20 msgid "Email:" msgstr "Sähköposti:" #: src/tjts5901/templates/auth/profile.html:35 msgid "Access Tokens" -msgstr "pääsytunniste" +msgstr "Pääsytunniste" + +#: src/tjts5901/templates/auth/profile.html:45 +msgid "Recent Auctions" +msgstr "Viimeisimmät huudot" #: src/tjts5901/templates/auth/profile.html:53 msgid "Starting Bid:" @@ -248,6 +291,11 @@ msgstr "Registeröidy käyttäjäksi" msgid "Login here" msgstr "Kirjudu tästä" +#: src/tjts5901/templates/auth/tokens.html:4 +#, fuzzy +msgid "Access tokens" +msgstr "pääsytunniste" + #: src/tjts5901/templates/auth/tokens.html:11 msgid "Personal Access Tokens" msgstr "Henkilökohtainen pääsytunniste" @@ -256,7 +304,9 @@ msgstr "Henkilökohtainen pääsytunniste" msgid "" "Personal access tokens allow third-party services to authenticate with " "our application on your behalf." -msgstr "Henkilökohtainen pääsytunniste sallii kolmannen osapuolten palveluiden kirjautumisen järjestelmäämme" +msgstr "" +"Henkilökohtainen pääsytunniste sallii kolmannen osapuolten palveluiden " +"kirjautumisen järjestelmäämme" #: src/tjts5901/templates/auth/tokens.html:19 msgid "Your new personal access token" @@ -266,7 +316,9 @@ msgstr "Uusi Henkilökohtainen pääsytunnisteesi" msgid "" "Your new personal access token is shown below. You may now use this token" " to make API requests." -msgstr "Uusi pääsytunnisteesi on alapuolella. Voit nyt käyttää sitä API pyyntöjen tekoon" +msgstr "" +"Uusi pääsytunnisteesi on alapuolella. Voit nyt käyttää sitä API pyyntöjen" +" tekoon" #: src/tjts5901/templates/auth/tokens.html:35 msgid "Make sure to copy your new token now. You won't be able to see it again!" @@ -285,7 +337,9 @@ msgstr "Nimi" msgid "" "Give your token a descriptive name so you can easily identify it in the " "future." -msgstr "Anna tunnisteellesi kuvaava nimi niin voit tunnistaa sen helposti tulevaisuudessa." +msgstr "" +"Anna tunnisteellesi kuvaava nimi niin voit tunnistaa sen helposti " +"tulevaisuudessa." #: src/tjts5901/templates/auth/tokens.html:50 msgid "Expires at" @@ -295,6 +349,11 @@ msgstr "Vanhenee" msgid "Leave blank to never expire." msgstr "Jätä tyhjäksi vanhentumisen välttämiseksi" +#: src/tjts5901/templates/auth/tokens.html:64 +#, fuzzy +msgid "Active Access Tokens" +msgstr "Luo pääsytunniste" + #: src/tjts5901/templates/auth/tokens.html:68 msgid "Token name" msgstr "Tokenin nimi" @@ -319,3 +378,13 @@ msgstr "Huutokaupat" msgid "Delete" msgstr "Poista" +#: tests/test_i18n.py:79 tests/test_i18n.py:103 +msgid "Hello, World!" +msgstr "Hei, Maailma" + +#~ msgid "Minimum bid is %(min_bid)s" +#~ msgstr "Minimi huuto on %(min_bid)s" + +#~ msgid "Lost password?" +#~ msgstr "Hukkasitko salasanasi?" + diff --git a/src/tjts5901/views.py b/src/tjts5901/views.py index 9712c1d9..a2f0028d 100644 --- a/src/tjts5901/views.py +++ b/src/tjts5901/views.py @@ -111,7 +111,7 @@ def check_auction_ends(): message = None for item in items_closed: # Get (potential) bids for the item and process them - message = (_("The auction of your item \'{}\' has ended. ".format(item.title))) + message = (_("The auction of your item \'{}\' has ended. ").format(item.title)) bids = Bid.objects(item=item).order_by('-amount') if len(bids) >= 1: message += (_("Congrats! It was sold for {}.".format(bids[0].amount))) -- GitLab