feat: Add localization support for contact and SAR marker display names

This commit is contained in:
Janez T
2025-10-16 21:09:33 +02:00
parent b6283e1c8f
commit c6c56f858d
6 changed files with 49 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import 'package:latlong2/latlong.dart';
import 'package:flutter/material.dart';
import 'contact_telemetry.dart';
import 'advert_location.dart';
import '../l10n/app_localizations.dart';
/// MeshCore contact types
enum ContactType {
@@ -213,6 +214,16 @@ class Contact {
return advName.substring(emoji.length).trim();
}
/// Get localized display name (for Public Channel and other special contacts)
String getLocalizedDisplayName(BuildContext context) {
// Check if this is the Public Channel (all-zeros public key)
if (publicKeyHex == '0000000000000000000000000000000000000000000000000000000000000000') {
return AppLocalizations.of(context)!.publicChannel;
}
// For all other contacts, use the regular display name
return displayName;
}
/// Check if contact has a learned routing path
/// When true, messages will use direct routing. When false, messages will use flood mode.
bool get hasPath => outPathLen > 0 && outPathLen <= 64;