Files
zonemaster.es/zonemaster-engine/t/translator.t
Malin 8d4eaa1489 feat: add full Zonemaster stack with Docker and Spanish UI
- Clone all 5 Zonemaster component repos (LDNS, Engine, CLI, Backend, GUI)
- Dockerfile.backend: 8-stage multi-stage build LDNS→Engine→CLI→Backend
- Dockerfile.gui: Astro static build served via nginx
- docker-compose.yml: backend (internal) + frontend (port 5353)
- nginx.conf: root redirects to /es/, /api/ proxied to backend
- zonemaster-gui/config.ts: defaultLanguage set to 'es' (Spanish)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:19:24 +02:00

65 lines
2.2 KiB
Perl

use strict;
use warnings;
use Test::More tests => 2;
use Test::NoWarnings;
use File::Slurp;
use POSIX qw[setlocale :locale_h];
use Test::Fatal;
use Zonemaster::Engine::Logger::Entry;
use Zonemaster::Engine::Translator;
my ($json, $profile_tmp);
$json = read_file( 't/profiles/Test-all.json' );
$profile_tmp = Zonemaster::Engine::Profile->from_json( $json );
Zonemaster::Engine::Profile->effective->merge( $profile_tmp );
$json = read_file( 't/profiles/Test-all-levels.json' );
$profile_tmp = Zonemaster::Engine::Profile->from_json( $json );
Zonemaster::Engine::Profile->effective->merge( $profile_tmp );
Zonemaster::Engine::Translator->initialize( locale => 'C' );
subtest 'Everything but Test::NoWarnings' => sub {
my $trans = Zonemaster::Engine::Translator->instance();
isa_ok $trans, 'Zonemaster::Engine::Translator',
'Zonemaster::Engine::Translator->instance()';
ok( exists $trans->data->{Basic}{B01_PARENT_FOUND}, 'expected key from file exists' );
ok( exists $trans->data->{System}{NO_NETWORK}, 'expected key from module exists' );
my $entry = Zonemaster::Engine::Logger::Entry->new(
{
module => 'Basic',
testcase => 'Basic01',
tag => 'B01_PARENT_FOUND',
args => { domain => 'nothing.nowhere', ns_list => 'ns1.nothing.nowhere/1.1.1.1' },
}
);
like(
$trans->to_string( $entry ),
qr' \d+.\d\d INFO The parent zone is "nothing.nowhere" as returned from name servers "ns1.nothing.nowhere/1.1.1.1".',
'string to_stringd as expected'
);
my $untranslated = Zonemaster::Engine::Logger::Entry->new(
{
module => 'SYSTEM',
testcase => 'Basic01',
tag => 'START_TIME',
args => { some => 'data' },
}
);
ok( $trans->translate_tag( $untranslated ), 'Untranslated tag gets output' );
my %methods = Zonemaster::Engine->all_methods();
foreach my $module ( keys %methods ) {
foreach my $testmethod ( @{ $methods{$module} } ) {
ok( $trans->_translate_tag( $module, uc( $testmethod ), {} ),
'Test method ' . uc( $testmethod ) . ' has message tag with description' );
}
}
};