From: Roland Häder Date: Tue, 8 Aug 2023 12:57:25 +0000 (+0200) Subject: WIP: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=refs%2Fheads%2Fbroken%2Fi18n-jinja2-support;p=fba.git WIP: - added i18n support - I still get an exception of missing tag 'trans' and I don't know how to hook i18n properly into Jinja2 - I found tutorials but they had their Python-based language files while this here follows: https://svn.python.org/projects/external/Jinja-2.1.1/docs/_build/html/extensions.html - if someone knows how to make this correctly, please tell me --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e4a8908 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +extract: + pybabel --verbose extract --sort-by-file --project=FBA --version=0.1.0 --mapping-file=babel.cfg --output-file=./i18n/messages.pot . diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000..6cd1b91 --- /dev/null +++ b/babel.cfg @@ -0,0 +1,2 @@ +[jinja2: **/templates/**.html] +encoding = utf-8 diff --git a/daemon.py b/daemon.py index e732851..3e8d7ba 100755 --- a/daemon.py +++ b/daemon.py @@ -24,12 +24,16 @@ from email.utils import format_datetime from pathlib import Path import fastapi + from fastapi import Request, HTTPException, Query from fastapi.responses import JSONResponse from fastapi.responses import PlainTextResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates +from babel.support import Translations +from jinja2 import Environment + import requests import uvicorn @@ -52,6 +56,10 @@ router.mount( name="static", ) +translations = Translations.load("i18n", ["de", "en"]) +env = Environment(extensions=["jinja2.ext.i18n"]) +env.install_gettext_translations(translations) + templates = Jinja2Templates(directory="templates") @router.get(config.get("base_url") + "/api/info.json", response_class=JSONResponse) diff --git a/i18n/de/LC_MESSAGES/.gitkeep b/i18n/de/LC_MESSAGES/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/i18n/en/LC_MESSAGES/.gitkeep b/i18n/en/LC_MESSAGES/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/i18n/messages.pot b/i18n/messages.pot new file mode 100644 index 0000000..7e17d79 --- /dev/null +++ b/i18n/messages.pot @@ -0,0 +1,508 @@ +# Translations template for FBA. +# Copyright (C) 2023 Free Software Foundation +# This file is distributed under the same license as the FBA project. +# Roland Häder , 2023. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: FBA 0.1.0\n" +"Report-Msgid-Bugs-To: roland@mxchange.org\n" +"POT-Creation-Date: 2023-08-08 14:00+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Roland Häder \n" +"Language-Team: English/German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.12.1\n" + +#: templates/base.html:9 +msgid "RSS Feed for latest blocked instances" +msgstr "" + +#: templates/base.html:17 +msgid "Page has no header" +msgstr "" + +#: templates/base.html:21 +msgid "Page has no content!" +msgstr "" + +#: templates/base.html:26 +msgid "Source code" +msgstr "" + +#: templates/base.html:31 +msgid "No slogan was found!" +msgstr "" + +#: templates/views/index.html:4 templates/views/infos.html:114 +#: templates/views/list.html:79 templates/views/scoreboard.html:130 +msgid "Index" +msgstr "" + +#: templates/views/index.html:7 +msgid "Welcome to FBA" +msgstr "" + +#: templates/views/index.html:14 +msgid "Choose an option" +msgstr "" + +#: templates/views/index.html:22 +msgid "Enter a domain:" +msgstr "" + +#: templates/views/index.html:26 templates/views/index.html:34 +#: templates/views/index.html:44 templates/views/index.html:51 +msgid "Submit" +msgstr "" + +#: templates/views/index.html:30 +msgid "Enter a reason:" +msgstr "" + +#: templates/views/index.html:40 +msgid "Reverse search:" +msgstr "" + +#: templates/views/index.html:48 +msgid "Info of a domain:" +msgstr "" + +#: templates/views/index.html:58 +msgid "Scoreboards:" +msgstr "" + +#: templates/views/index.html:60 +msgid "Defederating instances" +msgstr "" + +#: templates/views/index.html:61 +msgid "Defederated instances" +msgstr "" + +#: templates/views/index.html:62 +msgid "Referencing instances" +msgstr "" + +#: templates/views/index.html:63 +msgid "Used software" +msgstr "" + +#: templates/views/index.html:64 +msgid "Commands" +msgstr "" + +#: templates/views/index.html:65 +msgid "Error codes" +msgstr "" + +#: templates/views/index.html:66 +msgid "Detection modes" +msgstr "" + +#: templates/views/index.html:67 +msgid "Average peers" +msgstr "" + +#: templates/views/index.html:68 +msgid "Obfuscating software" +msgstr "" + +#: templates/views/index.html:69 templates/views/scoreboard.html:8 +#: templates/views/scoreboard.html:39 +msgid "Obfuscation statistics" +msgstr "" + +#: templates/views/index.html:70 +msgid "Block level statistics" +msgstr "" + +#: templates/views/index.html:76 +msgid "Infos:" +msgstr "" + +#: templates/views/index.html:80 +msgid "Known instances:" +msgstr "" + +#: templates/views/index.html:81 +msgid "Supported instances:" +msgstr "" + +#: templates/views/index.html:82 +msgid "Blocks recorded:" +msgstr "" + +#: templates/views/index.html:83 +msgid "Erroneous instances:" +msgstr "" + +#: templates/views/infos.html:4 +#, python-format +msgid "Infos on domain %(domain)s" +msgstr "" + +#: templates/views/infos.html:7 +#, python-format +msgid "Infos on %(domain)s" +msgstr "" + +#: templates/views/infos.html:14 +msgid "Instance information" +msgstr "" + +#: templates/views/infos.html:20 +msgid "Domain name:" +msgstr "" + +#: templates/views/infos.html:25 +msgid "Domain hash:" +msgstr "" + +#: templates/views/infos.html:30 +msgid "Software:" +msgstr "" + +#: templates/views/infos.html:35 +msgid "Originating instance:" +msgstr "" + +#: templates/views/infos.html:40 +msgid "Command:" +msgstr "" + +#: templates/views/infos.html:45 +msgid "Detection mode:" +msgstr "" + +#: templates/views/infos.html:50 +msgid "NodeInfo URL:" +msgstr "" + +#: templates/views/infos.html:55 +msgid "Total peers:" +msgstr "" + +#: templates/views/infos.html:60 +msgid "Total blocks:" +msgstr "" + +#: templates/views/infos.html:65 +msgid "Obfuscated blocks:" +msgstr "" + +#: templates/views/infos.html:70 +msgid "Has obfuscated block list:" +msgstr "" + +#: templates/views/infos.html:71 +msgid "Yes" +msgstr "" + +#: templates/views/infos.html:71 +msgid "No" +msgstr "" + +#: templates/views/infos.html:75 +msgid "First seen:" +msgstr "" + +#: templates/views/infos.html:80 +msgid "Last updated:" +msgstr "" + +#: templates/views/infos.html:85 +msgid "Last nodeinfo fetched:" +msgstr "" + +#: templates/views/infos.html:90 +msgid "Last blocks fetched:" +msgstr "" + +#: templates/views/infos.html:95 +msgid "Last instances fetched:" +msgstr "" + +#: templates/views/infos.html:100 +msgid "Last status code:" +msgstr "" + +#: templates/views/infos.html:105 +msgid "Last error details:" +msgstr "" + +#: templates/views/list.html:4 +#, python-format +msgid " - Detection mode %(value)s" +msgstr "" + +#: templates/views/list.html:5 +#, python-format +msgid " - Used software %(value)s" +msgstr "" + +#: templates/views/list.html:6 +#, python-format +msgid " - Command %(value)s" +msgstr "" + +#: templates/views/list.html:12 +#, python-format +msgid "Instances detected by method %(value)s" +msgstr "" + +#: templates/views/list.html:14 +#, python-format +msgid "Instances using software %(value)s" +msgstr "" + +#: templates/views/list.html:16 +#, python-format +msgid "Instances found by command %(value)s" +msgstr "" + +#: templates/views/list.html:18 +#, python-format +msgid "Instances originated from %(value)s" +msgstr "" + +#: templates/views/list.html:20 templates/views/scoreboard.html:43 +#, python-format +msgid "mode=%(mode)s not supported" +msgstr "" + +#: templates/views/list.html:27 +msgid "Maximum amount reached!" +msgstr "" + +#: templates/views/list.html:29 +msgid "" +"Please note that the maximum allowed amount is only returned, the " +"blocker/blocked/reason might be more.\n" +" Paging support is not finished yet." +msgstr "" + +#: templates/views/list.html:37 +msgid "Domain" +msgstr "" + +#: templates/views/list.html:38 +msgid "Origin" +msgstr "" + +#: templates/views/list.html:39 templates/views/scoreboard.html:53 +msgid "Software" +msgstr "" + +#: templates/views/list.html:40 templates/views/scoreboard.html:55 +msgid "Detection mode" +msgstr "" + +#: templates/views/list.html:41 +msgid "Command" +msgstr "" + +#: templates/views/list.html:42 +msgid "First added" +msgstr "" + +#: templates/views/list.html:43 +msgid "Last updated" +msgstr "" + +#: templates/views/scoreboard.html:5 +#, python-format +msgid "TOP %(amount)s used software" +msgstr "" + +#: templates/views/scoreboard.html:6 templates/views/scoreboard.html:33 +msgid "Detection mode statistics" +msgstr "" + +#: templates/views/scoreboard.html:7 +#, python-format +msgid "TOP %(amount)s block level statistics" +msgstr "" + +#: templates/views/scoreboard.html:9 templates/views/scoreboard.html:37 +#, python-format +msgid "TOP %(amount)s obfuscating software" +msgstr "" + +#: templates/views/scoreboard.html:10 templates/views/scoreboard.html:35 +#, python-format +msgid "TOP %(amount)s average peer count" +msgstr "" + +#: templates/views/scoreboard.html:11 +msgid "t}} commands" +msgstr "" + +#: templates/views/scoreboard.html:12 +msgid "t}} error codes" +msgstr "" + +#: templates/views/scoreboard.html:13 +msgid "t}} referencing instances" +msgstr "" + +#: templates/views/scoreboard.html:14 +msgid "t}} deferated instances" +msgstr "" + +#: templates/views/scoreboard.html:15 +msgid "t}} deferating instances" +msgstr "" + +#: templates/views/scoreboard.html:21 +#, python-format +msgid "Top %(amount)s defederating instances" +msgstr "" + +#: templates/views/scoreboard.html:23 +#, python-format +msgid "Top %(amount)s defederated instances" +msgstr "" + +#: templates/views/scoreboard.html:25 +#, python-format +msgid "Top %(amount)s referencing instances" +msgstr "" + +#: templates/views/scoreboard.html:27 +#, python-format +msgid "Top %(amount)s used software" +msgstr "" + +#: templates/views/scoreboard.html:29 +#, python-format +msgid "TOP %(amount)s commands" +msgstr "" + +#: templates/views/scoreboard.html:31 +#, python-format +msgid "TOP %(amount)s error codes" +msgstr "" + +#: templates/views/scoreboard.html:41 +#, python-format +msgid "TOP %(amount)s block levels" +msgstr "" + +#: templates/views/scoreboard.html:54 +msgid "Obfuscation status" +msgstr "" + +#: templates/views/scoreboard.html:56 +msgid "Error code" +msgstr "" + +#: templates/views/scoreboard.html:57 +msgid "Instance" +msgstr "" + +#: templates/views/scoreboard.html:61 +msgid "References" +msgstr "" + +#: templates/views/scoreboard.html:62 +msgid "Average" +msgstr "" + +#: templates/views/scoreboard.html:63 +msgid "Total" +msgstr "" + +#: templates/views/scoreboard.html:64 +msgid "Blocks" +msgstr "" + +#: templates/views/scoreboard.html:101 +msgid "Error codes:" +msgstr "" + +#: templates/views/scoreboard.html:103 +msgid "" +"Error code 999 is fake and covers a lot of reasons why the " +"domain/instance is not reachable. Mostly that the domain is not " +"resolvable or the server refused connection." +msgstr "" + +#: templates/views/scoreboard.html:108 +msgid "Detection modes:" +msgstr "" + +#: templates/views/scoreboard.html:110 +msgid "Detection is done in following order:" +msgstr "" + +#: templates/views/scoreboard.html:113 +msgid "" +"/.well-known/nodeinfo was reachable and software type was " +"found in nodeinfo response" +msgstr "" + +#: templates/views/scoreboard.html:114 +msgid "Node information was found by probing for well-known URLs" +msgstr "" + +#: templates/views/scoreboard.html:115 +msgid "Meta data generator was found in HTML code" +msgstr "" + +#: templates/views/scoreboard.html:116 +msgid "Meta data og:platform was found in HTML code" +msgstr "" + +#: templates/views/scoreboard.html:117 +msgid "Meta data og:site_name was found in HTML code" +msgstr "" + +#: templates/views/scoreboard.html:118 +msgid "the instance was not reachable or the used software was not stated" +msgstr "" + +#: templates/views/scoreboard.html:118 templates/widgets/list_links.html:4 +msgid "None" +msgstr "" + +#: templates/views/scoreboard.html:123 +msgid "Obfuscation status:" +msgstr "" + +#: templates/views/scoreboard.html:125 +msgid "Only supported networks are counted here." +msgstr "" + +#: templates/views/scoreboard.html:126 +msgid "None means not determined yet or erroneous." +msgstr "" + +#: templates/widgets/links.html:2 +#, python-format +msgid "Search %(domain)s" +msgstr "" + +#: templates/widgets/links.html:3 +#, python-format +msgid "Reverse search %(domain)s" +msgstr "" + +#: templates/widgets/links.html:4 templates/widgets/list_links.html:2 +#, python-format +msgid "Information on domain %(domain)s" +msgstr "" + +#: templates/widgets/links.html:5 +#, python-format +msgid "Instances from origin %(domain)s" +msgstr "" + +#: templates/widgets/links.html:6 +#, python-format +msgid "Visit website at %(domain)s" +msgstr "" + diff --git a/requirements.txt b/requirements.txt index ccdbeaf..c587e18 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ argparse atoma +babel beautifulsoup4 markdown reqto diff --git a/templates/base.html b/templates/base.html index 8701138..d854614 100644 --- a/templates/base.html +++ b/templates/base.html @@ -8,7 +8,7 @@ - + {% block rss %}{% endblock %} @@ -16,21 +16,21 @@
- {% block content %}Page has no content!{% endblock %} + {% block content %}{% trans %}Page has no content!{% endtrans %}{% endblock %}
diff --git a/templates/views/index.html b/templates/views/index.html index 3286a4e..d145b1c 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -1,15 +1,17 @@ {% extends "base.html" %} -{% block title %}Index{% endblock %} +{% block title %} + {% trans %}Index{% endtrans %} +{% endblock %} -{% block header %}

Welcome to FBA

{% endblock %} +{% block header %}

{% trans %}Welcome to FBA{% endtrans %}

{% endblock %} {% block content %} @@ -17,75 +19,75 @@
-

Choose an option

+

{% trans %}Choose an option{% endtrans %}

-

Enter a domain:

+

{% trans %}Enter a domain:{% endtrans %}

- +
-

Enter a reason:

+

{% trans %}Enter a reason:{% endtrans %}

- +
-

Reverse search:

+

{% trans %}Reverse search:{% endtrans %}

- +
-

Info of a domain:

+

{% trans %}Info of a domain:{% endtrans %}

- +
-

Scoreboards:

+

{% trans %}Scoreboards:{% endtrans %}

-

Recently ...:

+

{% trans %}Recently ...:{% endtrans %}

{% endblock %} + {% block footer %}
-

Infos:

+

{% trans %}Infos:{% endtrans %}

- - - - + + + + diff --git a/templates/views/infos.html b/templates/views/infos.html index 776c6f5..c39da6b 100644 --- a/templates/views/infos.html +++ b/templates/views/infos.html @@ -1,31 +1,33 @@ {% extends "base.html" %} -{% block title %}Infos on domain {{domain}}{% endblock %} +{% block title %} + {% trans %}Infos on domain {{domain}}{% endtrans %} +{% endblock %} -{% block header %}

Infos on {{domain}}

{% endblock %} +{% block header %}

{% trans %}Infos on {{domain}}{% endtrans %}

{% endblock %} {% block content %}
Total websites:Supported instances:Blocks recorded:Erroneous instances:{% trans %}Total websites:{% endtrans %}{% trans %}Supported instances:{% endtrans %}{% trans %}Blocks recorded:{% endtrans %}{% trans %}Erroneous instances:{% endtrans %}
- + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + @@ -146,6 +148,6 @@ {% endblock %} {% block footer %} - Index / + {% trans %}Index{% endtrans %} / {{ super() }} {% endblock %} diff --git a/templates/views/list.html b/templates/views/list.html index 548dc87..0f3e0aa 100644 --- a/templates/views/list.html +++ b/templates/views/list.html @@ -1,69 +1,69 @@ {% extends "base.html" %} {% block title %} - {% if mode == 'detection_mode' %} Detection mode {{value}} - {% elif mode == 'original_software' %} Original software {{value}} - {% elif mode == 'software' %} Used software {{value}} - {% elif mode == 'command' %} Command {{value}} - {% elif mode == 'added' %} {{amount}} recently added instances - {% elif mode == 'updated' %} {{amount}} recently updated instances + {% if mode == 'detection_mode' %}{% trans %}Detection mode {{value}}{% endtrans %} + {% elif mode == 'original_software' %}{% trans %}Original software {{value}}{% endtrans %} + {% elif mode == 'software' %}{% trans %}Used software {{value}}{% endtrans %} + {% elif mode == 'command' %}{% trans %}Command {{value}}{% endtrans %} + {% elif mode == 'added' %}{% trans %}{{amount}} recently added instances{% endtrans %} + {% elif mode == 'updated' %}{% trans %}{{amount}} recently updated instances{% endtrans %} {% endif %} {% endblock %} {% block header %} {% if mode == 'detection_mode' %} -

Instances detected by method {{value}}

+

{% trans %}Instances detected by method {{value}}{% endtrans %}

{% elif mode == 'original_software' %} -

Original software name {{value}}

+

{% trans %}Original software name {{value}}{% endtrans %}

{% elif mode == 'software' %} -

Instances using software {{value}}

+

{% trans %}Instances using software {{value}}{% endtrans %}

{% elif mode == 'command' %} -

Instances found by command {{value}}

+

{% trans %}Instances found by command {{value}}{% endtrans %}

{% elif mode == 'origin' %} -

Instances originated from {{value}}

+

{% trans %}Instances originated from {{value}}{% endtrans %}

{% elif mode == 'added' %} -

{{amount}} recently added instances

+

{% trans %}{{amount}} recently added instances{% endtrans %}

{% elif mode == 'updated' %} -

{{amount}} recently updated instances

+

{% trans %}{{amount}} recently updated instances{% endtrans %}

{% else %} -

mode={{mode}} not supported

+

{% trans %}mode={{mode}} not supported{% endtrans %}

{% endif %} {% endblock %} {% block content %} {% if amount == found %}
-

Maximum amount reached!

+

{% trans %}Maximum amount reached!{% endtrans %}

- Please note that the maximum allowed amount is only returned, the blocker/blocked/reason might be more. - Paging support is not finished yet. + {% trans %}Please note that the maximum allowed amount is only returned, the blocker/blocked/reason might be more. + Paging support is not finished yet.{% endtrans %}
{% endif %}
-

Instance information

+

{% trans %}Instance information{% endtrans %}

Domain name:{% trans %}Domain name:{% endtrans %} {% with domain=instance['domain'] %}{% include "widgets/links.html" %}{% endwith %}
Domain hash:{% trans %}Domain hash:{% endtrans %} {{instance['hash']}}
Original software:{% trans %}Original software:{% endtrans %} {% if instance['original_software'] != None %} {{instance['original_software']}} @@ -36,7 +38,7 @@
Aliased software:{% trans %}Aliased software:{% endtrans %} {% if instance['software'] != None %} {{instance['software']}} @@ -47,7 +49,7 @@
Originating instance:{% trans %}Originating instance:{% endtrans %} {% if instance['origin'] != None %} {% with domain=instance['origin'] %}{% include "widgets/links.html" %}{% endwith %} @@ -58,15 +60,15 @@
Command:{% trans %}Command:{% endtrans %} {{instance['command']}} - - Show + {% trans %}Show{% endtrans %}
Detection mode:{% trans %}Detection mode:{% endtrans %} {% if instance['detection_mode'] != None %} {{instance['detection_mode']}} @@ -77,67 +79,67 @@
NodeInfo URL:{% trans %}NodeInfo URL:{% endtrans %} {{instance['nodeinfo_url']}}
Total peers:{% trans %}Total peers:{% endtrans %} {{instance['total_peers']}}
Total blocks:{% trans %}Total blocks:{% endtrans %} {{instance['total_blocks']}}
Last response time:{% trans %}Last response time:{% endtrans %} {{'%0.2f'|format(instance['last_response_time']|float)}}
Obfuscated blocks:{% trans %}Obfuscated blocks:{% endtrans %} {{instance['obfuscated_blocks']}}
Has obfuscated block list:{% if instance['has_obfuscation']%}Yes{%elif not instance['has_obfuscation']%}No{%else%}-{%endif%}{% trans %}Has obfuscated block list:{% endtrans %}{% if instance['has_obfuscation']%}{% trans %}Yes{% endtrans %}{%elif not instance['has_obfuscation']%}{% trans %}No{% endtrans %}{%else%}-{%endif%}
First seen:{% trans %}First seen:{% endtrans %} {{instance['first_seen']}}
Last updated:{% trans %}Last updated:{% endtrans %} {{instance['last_updated']}}
Last nodeinfo fetched:{% trans %}Last nodeinfo fetched:{% endtrans %} {{instance['last_nodeinfo']}}
Last blocks fetched:{% trans %}Last blocks fetched:{% endtrans %} {{instance['last_blocked']}}
Last instances fetched:{% trans %}Last instances fetched:{% endtrans %} {{instance['last_instance_fetch']}}
Last status code:{% trans %}Last status code:{% endtrans %} {{instance['last_status_code']}}
Last error details:{% trans %}Last error details:{% endtrans %} {{instance['last_error_details']}}
- - - - - - - - - + + + + + + + + + @@ -110,13 +110,13 @@ {% block footer %}
-

Please note:

+

{% trans %}Please note:{% endtrans %}

    -
  • Total peer and block count are much lower than you might find on the individual instance.
  • -
  • This has the simple reason that this instance count does not include blacklisted instances.
  • +
  • {% trans %}Total peer and block count are much lower than you might find on the individual instance.{% endtrans %}
  • +
  • {% trans %}This has the simple reason that this instance count does not include blacklisted instances.{% endtrans %}
- Index / + {% trans %}Index{% endtrans %} / {{ super() }} {% endblock %} diff --git a/templates/views/scoreboard.html b/templates/views/scoreboard.html index 1cc68b7..03b5866 100644 --- a/templates/views/scoreboard.html +++ b/templates/views/scoreboard.html @@ -2,51 +2,51 @@ {% block title %} Scoreboard - - {% if mode == 'original_software' %}TOP {{amount}} original software - {% elif mode == 'software' %}TOP {{amount}} aliased software - {% elif mode == 'detection_mode' %}Detection mode statistics - {% elif mode == 'block_level' %}TOP {{amount}} block level statistics - {% elif mode == 'obfuscation' %}Obfuscation statistics - {% elif mode == 'obfuscator' %}TOP {{amount}} obfuscating software - {% elif mode == 'avg_peers' %}TOP {{amount}} average peer count - {% elif mode == 'avg_blocks' %}TOP {{amount}} average block count - {% elif mode == 'command' %}TOP {{amount}} commands - {% elif mode == 'error_code' %}TOP {{amount}} error codes - {% elif mode == 'reference' %}TOP {{amount}} referencing instances - {% elif mode == 'blocked' %}TOP {{amount}} deferated instances - {% elif mode == 'blocker' %}TOP {{amount}} deferating instances + {% if mode == 'original_software' %}{% trans %}TOP {{amount}} original software{% endtrans %} + {% elif mode == 'software' %}{% trans %}TOP {{amount}} used software{% endtrans %} + {% elif mode == 'detection_mode' %}{% trans %}Detection mode statistics{% endtrans %} + {% elif mode == 'block_level' %}{% trans %}TOP {{amount}} block level statistics{% endtrans %} + {% elif mode == 'obfuscation' %}{% trans %}Obfuscation statistics{% endtrans %} + {% elif mode == 'obfuscator' %}{% trans %}TOP {{amount}} obfuscating software{% endtrans %} + {% elif mode == 'avg_peers' %}{% trans %}TOP {{amount}} average peer count{% endtrans %} + {% elif mode == 'avg_blocks' %}{% trans %}TOP {{amount}} average block count{% endtrans %} + {% elif mode == 'command' %}{% trans %}t}} commands{% endtrans %} + {% elif mode == 'error_code' %}{% trans %}t}} error codes{% endtrans %} + {% elif mode == 'reference' %}{% trans %}t}} referencing instances{% endtrans %} + {% elif mode == 'blocked' %}{% trans %}t}} deferated instances{% endtrans %} + {% elif mode == 'blocker' %}{% trans %}t}} deferating instances{% endtrans %} {% endif %} {% endblock %} {% block header %} {% if mode == 'blocker' %} -

Top {{amount}} defederating instances

+

{% trans %}Top {{amount}} defederating instances{% endtrans %}

{% elif mode == 'blocked' %} -

Top {{amount}} defederated instances

+

{% trans %}Top {{amount}} defederated instances{% endtrans %}

{% elif mode == 'reference' %} -

Top {{amount}} referencing instances

+

{% trans %}Top {{amount}} referencing instances{% endtrans %}

{% elif mode == 'original_software' %} -

Top {{amount}} original software names

+

{% trans %}Top {{amount}} original software names{% endtrans %}

{% elif mode == 'software' %} -

Top {{amount}} aliased software

+

{% trans %}Top {{amount}} used software{% endtrans %}

{% elif mode == 'command' %} -

TOP {{amount}} commands

+

{% trans %}TOP {{amount}} commands{% endtrans %}

{% elif mode == 'error_code' %} -

TOP {{amount}} error codes

+

{% trans %}TOP {{amount}} error codes{% endtrans %}

{% elif mode == 'detection_mode' %} -

Detection mode statistics

+

{% trans %}Detection mode statistics{% endtrans %}

{% elif mode == 'avg_peers' %} -

TOP {{amount}} average peer count

+

{% trans %}TOP {{amount}} average peer count{% endtrans %}

{% elif mode == 'avg_blocks' %} -

TOP {{amount}} average block count

+

{% trans %}TOP {{amount}} average block count{% endtrans %}

{% elif mode == 'obfuscator' %} -

TOP {{amount}} obfuscating software

+

{% trans %}TOP {{amount}} obfuscating software{% endtrans %}

{% elif mode == 'obfuscation' %} -

Obfuscation statistics

+

{% trans %}Obfuscation statistics{% endtrans %}

{% elif mode == 'block_level' %} -

TOP {{amount}} block levels

+

{% trans %}TOP {{amount}} block levels{% endtrans %}

{% else %} -

mode={{mode}} not supported

+

{% trans %}mode={{mode}} not supported{% endtrans %}

{% endif %} {% endblock %} @@ -56,18 +56,18 @@ @@ -104,36 +104,36 @@ {% block footer %} {% if mode == 'error_code' %}
-

Error codes:

+

{% trans %}Error codes:{% endtrans %}

    -
  • Error code 999 is fake and covers a lot of reasons why the domain/instance is not reachable. Mostly that the domain is not resolvable or the server refused connection.
  • +
  • {% trans %}Error code 999 is fake and covers a lot of reasons why the domain/instance is not reachable. Mostly that the domain is not resolvable or the server refused connection.{% endtrans %}
{% elif mode == 'detection_mode' %}
-

Detection modes:

+

{% trans %}Detection modes:{% endtrans %}

- Detection is done in following order: + {% trans %}Detection is done in following order:{% endtrans %}
    -
  1. AUTO_DISCOVERY: /.well-known/nodeinfo was reachable and software type was found in nodeinfo response
  2. -
  3. STATIC_CHECK: Node information was found by probing for well-known URLs
  4. -
  5. PLATFORM: Meta data og:platform was found in HTML code
  6. -
  7. GENERATOR: Meta data generator was found in HTML code
  8. -
  9. APP_NAME: Meta data application-name was found in HTML code
  10. -
  11. SITE_NAME: Meta data og:site_name was found in HTML code
  12. -
  13. None: the instance was not reachable or the used software was not stated
  14. +
  15. AUTO_DISCOVERY: {% trans %}/.well-known/nodeinfo was reachable and software type was found in nodeinfo response{% endtrans %}
  16. +
  17. STATIC_CHECK: {% trans %}Node information was found by probing for well-known URLs{% endtrans %}
  18. +
  19. PLATFORM: {% trans %}Meta data og:platform was found in HTML code{% endtrans %}
  20. +
  21. GENERATOR: {% trans %}Meta data generator was found in HTML code{% endtrans %}
  22. +
  23. APP_NAME: {% transd %}Meta data application-name was found in HTML code{% endtrans %}
  24. +
  25. SITE_NAME: {% trans %}Meta data og:site_name was found in HTML code{% endtrans %}
  26. +
  27. {% trans %}None{% endtrans %}: {% trans %}the instance was not reachable or the used software was not stated{% endtrans %}
{% elif mode == 'obfuscation' %}
-

Obfuscation status:

+

{% trans %}Obfuscation status:{% endtrans %}

    -
  • Only supported networks are counted here.
  • -
  • None means not determined yet or erroneous.
  • +
  • {% trans %}Only supported networks are counted here.{% endtrans %}
  • +
  • {% trans %}None means not determined yet or erroneous.{% endtrans %}
{% endif %} - Index / + {% trans %}Index{% endtrans %} / {{ super() }} {% endblock %} diff --git a/templates/views/top.html b/templates/views/top.html index eb8169e..b2e1f4b 100644 --- a/templates/views/top.html +++ b/templates/views/top.html @@ -1,38 +1,38 @@ {% extends "base.html" %} {% block title %} - {% if mode == 'domain' %} Instances that block {{value}} - {% elif mode == 'reverse' %} Instances that are blocked by {{value}} - {% elif mode == 'reason' %} Instances having block reason {{value}} + {% if mode == 'domain' %}{% trans %}Instances that block {{value}}{% endtrans %} + {% elif mode == 'reverse' %}{% trans %}Instances that are blocked by {{value}}{% endtrans %} + {% elif mode == 'reason' %}{% trans %}Instances having block reason {{value}}{% endtrans %} {% endif %} {% endblock %} {% block rss %} {{ super() }} {% if mode == 'domain' %} - + {% elif mode == 'reverse' %} - + {% endif %} {% endblock %} {% block header %} {% if mode == 'reason' %} -

Instances that use "{{value}}" in their reason

+

{% trans %}Instances that use "{{value}}" in their reason{% endtrans %}

{% elif mode == 'reverse' %} -

Instances that are blocked by {{value}}

+

{% trans %}Instances that are blocked by {{value}}{% trans %}

{% elif mode == 'domain' %} -

Instances that block {{value}}

+

{% trans %}Instances that block {{value}}{% endtrans %}

{% endif %} {% endblock %} {% block content %} {% if amount == found %}
-

Maximum amount reached!

+

{% trans %}Maximum amount reached!{% endtrans %}

- Please note that the maximum allowed amount is only returned, the blocker/blocked/reason might be more. - Paging support is not finished yet. + {% trans %}Please note that the maximum allowed amount is only returned, the blocker/blocked/reason might be more. + Paging support is not finished yet.{% endtrans %}
{% endif %} @@ -42,11 +42,11 @@

{{block_level}} ({{blocklist[block_level]|length}})

DomainOriginSoftwareOriginalDetection modeCommandTotal peersTotal blocksResponse time{% trans %}Domain{% endtrans %}{% trans %}Origin{% endtrans %}{% trans %}Software{% endtrans %}{% trans %}Original{% endtrans %}{% trans %}Detection mode{% endtrans %}{% trans %}Command{% endtrans %}{% trans %}Total peers{% endtrans %}{% trans %}Total blocks{% endtrans %}{% trans %}Response time{% endtrans %} {% if mode != "added" %} - First added + {% trans %}First added{% endtrans %} {% else %} - First added + {% trans %}First added{% endtrans %} {% endif %} {% if mode != "updated" %} - Last updated + {% trans %}Last updated{% endtrans %} {% else %} - Last updated + {% trans %}Last updated{% endtrans %} {% endif %}
№ - {% if mode in ('original_software', 'software', 'avg_peers', 'avg_blocks', 'obfuscator') %}Software - {% elif mode == 'obfuscation' %}Obfuscation status - {% elif mode == 'detection_mode' %}Detection mode - {% elif mode == 'error_code' %}Error code - {% else %}Instance + {% if mode in ('original_software', 'software', 'avg_peers', 'avg_blocks', 'obfuscator') %}{% trans %}Software{% endtrans %} + {% elif mode == 'obfuscation' %}{% trans %}Obfuscation status{% endtrans %} + {% elif mode == 'detection_mode' %}{% trans %}Detection mode{% endtrans %} + {% elif mode == 'error_code' %}{% trans %}Error code{% endtrans %} + {% else %}{% trans %}Instance{% endtrans %} {% endif %} - {% if mode == 'reference' %}References - {% elif mode in('avg_peers', 'avg_blocks') %}Average - {% elif mode in('original_software', 'software', 'error_code', 'obfuscator', 'obfuscation', 'block_level', 'detection_mode', 'command') %}Total - {% else %}Blocks + {% if mode == 'reference' %}{% trans %}References{% endtrans %} + {% elif mode == 'avg_peers' %}{% trans %}Average{% endtrans %} + {% elif mode in('software', 'error_code', 'obfuscator', 'obfuscation', 'block_level', 'detection_mode', 'command') %}{% trans %}Total{% endtrans %} + {% else %}{% trans %}Blocks{% endtrans %} {% endif %}
- - - - - + + + + + @@ -72,7 +72,8 @@ {% endfor %} {% endblock %} + {% block footer %} - Index / + {% trans %}Index{% endtrans %} / {{ super() }} {% endblock %} diff --git a/templates/widgets/links.html b/templates/widgets/links.html index a8e69bc..e1cd773 100644 --- a/templates/widgets/links.html +++ b/templates/widgets/links.html @@ -1,9 +1,9 @@ {% if domain != None %} - [D] - [R] - [I] - [O] - {{domain}} + [D] + [R] + [I] + [O] + {{domain}} {% else %} - {% endif %} diff --git a/templates/widgets/list_links.html b/templates/widgets/list_links.html index 00bdcf6..f2b6ba1 100644 --- a/templates/widgets/list_links.html +++ b/templates/widgets/list_links.html @@ -1,5 +1,5 @@ {% if value != None %} - {{value}} + {{value}} {% else %} - None + {% trans %}None{% endtrans %} {% endif %}
Blocker{% if block_level == 'accept' %}Accepted{% else %}Blocked{% endif %}ReasonFirst addedLast seen{% trans %}Blocker{% endtrans %}{% if block_level == 'accept' %}{% trans %}Accepted{% endtrans %}{% else %}{% trans %}Blocked{% endtrans %}{% endif %}{% trans %}Reason{% endtrans %}{% trans %}First added{% endtrans %}{% trans %}Last seen{% trans %}