+11
-6
src/http/handle_event_location_venue.rs
+11
-6
src/http/handle_event_location_venue.rs
···
294
294
Ok(response) => {
295
295
debug!("Event location venue search completed: {} results", response.venues.len());
296
296
297
-
// Convert to event location format
297
+
// Convert to event location format with language context
298
298
let event_venues: Vec<EventLocationVenueResult> = response.venues
299
299
.into_iter()
300
-
.map(convert_venue_to_event_location_result)
300
+
.map(|venue| convert_venue_to_event_location_result(venue, Some(&language.to_string())))
301
301
.collect();
302
302
303
303
// Prepare template context
···
469
469
).await {
470
470
Ok(venue_result) => {
471
471
let (is_valid, matched_venue, confidence) = if let Some(venue) = venue_result {
472
-
let event_venue = convert_venue_to_event_location_result(venue);
472
+
let event_venue = convert_venue_to_event_location_result(venue, Some(&language.to_string()));
473
473
(true, Some(event_venue), 0.9) // High confidence for exact matches
474
474
} else {
475
475
(false, None, 0.0)
···
751
751
}
752
752
753
753
/// Convert venue search result to event location format
754
-
fn convert_venue_to_event_location_result(venue: VenueSearchResult) -> EventLocationVenueResult {
754
+
fn convert_venue_to_event_location_result(venue: VenueSearchResult, language: Option<&str>) -> EventLocationVenueResult {
755
755
// Extract display name from address or use venue type
756
756
let display_name = match &venue.address {
757
757
crate::atproto::lexicon::community::lexicon::location::Address::Current { name, .. } => {
···
762
762
// Create formatted address
763
763
let formatted_address = Some(format_address_for_display(&venue.address));
764
764
765
-
// Extract category from venue details and convert to string
765
+
// Extract category from venue details and convert to localized string
766
766
let category = venue.details.as_ref()
767
767
.and_then(|details| details.category.as_ref())
768
-
.map(|cat| cat.display_name(None).to_string());
768
+
.map(|cat| {
769
+
let lang_str = language.map(|l| l.to_string());
770
+
let lang_ref = lang_str.as_deref();
771
+
tracing::debug!("Venue category: {:?} with language {:?} -> {}", cat, lang_ref, cat.display_name(lang_ref));
772
+
cat.display_name(lang_ref).to_string()
773
+
});
769
774
770
775
// Use venue_type as description if available
771
776
let description = venue.details.as_ref()
+4
-1
src/services/venues/venue_types.rs
+4
-1
src/services/venues/venue_types.rs
···
184
184
185
185
/// Get localized display name
186
186
pub fn display_name(&self, language: Option<&str>) -> &'static str {
187
-
match (self, language) {
187
+
let normalized_language = language.map(|s| s.to_lowercase());
188
+
let lang_ref = normalized_language.as_deref();
189
+
190
+
match (self, lang_ref) {
188
191
(Self::Restaurant, Some("fr-ca")) => "Restaurant",
189
192
(Self::Restaurant, _) => "Restaurant",
190
193
(Self::Cafe, Some("fr-ca")) => "Café",