mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
feat: Add localization support for contact and SAR marker display names
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user