helldivers-2 / api

A community driven API for Helldivers 2
https://helldivers-2.github.io/api/
MIT License
211 stars 19 forks source link

API responding with `null` for lang `de` #9

Closed Kejax closed 5 months ago

Kejax commented 6 months ago

After the addition of different languages to the API, it seems that it‘s only responding with a NULL value for the german translation of the string. I‘m not familiar with Elixir, but from what I understand, you iterate through the different languages. The languages are defined in your env, so please check if de is set to de-DE

[
  {
    "assignment_id_32": 525659126,
    "effects": [],
    "flag": 1,
    "id": 1499082,
    "id_32": 0,
    "message": {
      "es": "Las esporas termínidas han inundado Heeth y Proyecto del Ángel y han engendrado hordas de termínidos que han aplastado las milicias coloniales. Es evidente que el instinto de colmena de esos bichos lleva a su irracional expansión a deshonrar el recuerdo de quienes lucharon por liberar estos planetas.\n\nTus compañeros Helldivers dieron su vida por estas tierras. No podemos perderlas. Mantén el control en los planetas hasta que lleguen los refuerzos S.E.A.F.",
      "fr": "Les spores terminides se répandent sur Hïs et le Périple de l'ange, des hordes d'insectes submergent les milices coloniales. De toute évidence, l'esprit de la ruche a décidé de cracher au visage des valeureux héros qui ont libéré ces planètes.\n\nVos compagnons d'armes ont sacrifié leur vie pour prendre le contrôle de ces territoires. Nous ne pouvons pas les abandonner. Gardez le contrôle de ces planètes jusqu'à l'arrivée des renforts de la Super-Terre.",
      "de": null,
      "en": "Terminid spores have engulfed Heeth and Angel's Venture, spawning hordes of Terminids that overwhelmed our colonial militias. Clearly, the bug hive instinct oriented their mindless expansion towards dishonoring the memory of those who fought to free these planets.\n\nYour fellow Helldivers paid for these lands with their lives. We cannot lose them now. Hold the planets until SEAF reinforcements arrive.",
      "it": "Le spore dei Terminidi hanno avvolto Heeth e Angel's Venture, generando orde di Terminidi che hanno sopraffatto le nostre milizie coloniali. Chiaramente, la mente alveare degli insetti ha portato la loro cieca espansione a disonorare la memoria di coloro che hanno combattuto per liberare questi pianeti.\n\nI vostri compagni Helldiver hanno dato la loro vita per questi territori. Non possiamo perderli. Difendeteli fino all'arrivo dei rinforzi FAST.",
      "pl": "Zarodniki terminidów wyroiły się w Heeth i Anielskim Przedsięwzięciu, co doprowadziło do pojawiania się hord terminidów, które pokonały nasze kolonialne bojówki. Najwyraźniej instynkt roju robali nakazał im bezmyślną ekspansję i zbezczeszczenie pamięci o tych, którzy walczyli o wyzwolenie tych planet.\n\nHelldiversi tacy jak ty zapłacili własnym życiem za te tereny. Nie możemy ich teraz utracić. Utrzymaj planety do czasu przybycia uzupełnień SZSZ.",
      "ru": "Споры терминидов окружили Хиит и Ангельский Риск и породили орды жуков, сломивших сопротивление планетарного ополчения. Определенно, коллективный инстинкт жуков теперь желает не только бессмысленно захватывать новые территории, но и опорочить память тех, кто боролся за освобождение этих планет.\n\nАдские Десантники заплатили за захват этих земель своими жизнями, потому мы не имеем права их потерять. Удерживайте эти планеты, пока не прибудут подкрепления ВССЗ."
    },
    "message_id_32": 2841401849,
    "planets": [],
    "portrait_id_32": 0,
    "race": "Humans",
    "title": "BRIEFING",
    "title_32": 2908633975
  },
  {
    "assignment_id_32": 0,
    "effects": [],
    "flag": 2,
    "id": 1499081,
    "id_32": 0,
    "message": {
      "es": "Bien hecho, Helldivers. A partir de ahora, los Equipos S.E.A.F. de contención se harán cargo de las operaciones de limpieza e inoculación. Se ha informado a los colonos de que no hay absolutamente ninguna amenaza de nuevos conflictos termínidos, y de que pueden asentarse con sus familias con toda tranquilidad.\n\nAdemás, los pilotos encargados de la limpieza de esporas en Veld ya han recibido órdenes de ocuparse de las operaciones de apoyo a los Helldivers. \n<i=1>La extracción será más rápida en todas las operaciones.</i>",
      "fr": "Bien joué, Helldivers. L'équipe de confinement des forces armées la Super-Terre va prendre en charge les opérations de nettoyage et de vaccination. Nous avons informé les colons qu'il n'y avait aucun risque de résurgence des terminides, mais aussi qu'ils pouvaient se réinstaller en toute quiétude.\n\nPar ailleurs, les pilotes chargés de dissiper les spores sur Veld vont être redéployés en soutien des Helldivers. \n<i=1>Les délais d'extraction seront plus courts pour toutes les opérations.</i> ",
      "de": null,
      "en": "Well done, Helldivers. SEAF Containment Teams will take over cleanup and inoculation operations from here. Colonists have been advised that there is absolutely zero threat of further Terminid violence, and to settle their families with total peace of mind.\n\nAdditionally, the pilots allocated to spore clearance on Veld have now been redirected to Helldiver support operations. \n<i=1>Extraction will be faster on all operations.</i> ",
      "it": "Bel lavoro, Helldiver. Le squadre di contenimento FAST si occuperanno delle operazioni di pulizia e inoculazione a partire da qui. I coloni sono stati informati che la minaccia di ulteriori attacchi da parte dei Terminidi è nulla e che possono stabilirsi con le loro famiglie in totale tranquillità.\n\nInoltre, i piloti assegnati alla rimozione delle spore su Veld sono stati reindirizzati alle operazioni di supporto degli Helldiver. \n<i=1>Le operazioni di estrazione saranno più veloci.</i> ",
      "pl": "Dobra robota, helldiversi. Oddziały likwidacyjne SZSZ zajmą się teraz czyszczeniem i szczepieniem. Koloniści otrzymali informację, że zagrożenie ze strony terminidów jest już absolutnie zerowe. Mogą spokojnie dokonywać osadnictwa wraz ze swoimi rodzinami.\n\nCo więcej, piloci przydzieleni wcześniej do oczyszczania Veld z zarodników, zostali teraz przeniesieni do operacji wsparcia helldiversów. \n<i=1>Podczas wszystkich operacji odbiór będzie szybszy.</i> ",
      "ru": "Отличная работа, Адские Десантники. Теперь команды сдерживания ВССЗ займутся зачисткой и иммунизацией. Колонистам сообщили, что угроза будущих нападений терминидов снижена до нуля и они могут без опаски селиться здесь вместе с семьями.\n\nТакже пилоты, отвечавшие за уничтожение спор на Вельде, в дальнейшем будут оказывать поддержку миссиям Адских Десантников.\n<i=1>С этого момента эвакуация во всех операциях будет происходить быстрее.</i>"
    },
    "message_id_32": 3767473056,
    "planets": [],
    "portrait_id_32": 0,
    "race": "Humans",
    "title": "SUCCESS",
    "title_32": 2998873950
  }
]
dealloc commented 6 months ago

I just checked, and now it's responding null for the French language image

It would appear there's something iffy going on in the synchronization process. Languages are configured here, where the key (for example de is linked to a language code (de-DE).

I suspect the API doesn't always properly respond (maybe because it synchronizes multiple languages concurrently and that might be a bit too fast at once) with the correct languages and when it fails the translation will not be present in the sync.

I'll see tonight if I can confirm my suspicions and provide a fix. Currently though it seems the problem 'resolves' itself after 5 minutes (aka the next sync)

Kejax commented 6 months ago

I somehow missed the config part… …Anyways. Maybe you could check if the value is null after caching the data, if so refetch the message

dealloc commented 6 months ago

With the way the API is currently set up it's rather hard to fall back to cache when rebuilding, will have to think of a proper way to deal with this

Kejax commented 6 months ago

I rather meant:

-> Fetch data: -> If "lang" is null: -> Fetch until lang is not null -> to Cache

Kejax commented 6 months ago

Very out of context, but what do you think about an "Helldivers Community Developers Discord (HCDD)" ?

dealloc commented 6 months ago

I rather meant:

-> Fetch data: -> If "lang" is null: -> Fetch until lang is not null -> to Cache

Ah, there's actually a retry mechanism in place but since it's not reliable in responding null it's a little hard debugging why it's not kicking in.

Very out of context, but what do you think about an "Helldivers Community Developers Discord (HCDD)" ?

That would definitely help with people who want to get started with the API as well as provide a central point of communication for developers to gather knowledge and information! That being said I have no experience (nor do I desire to) moderating and maintaining such a public discord. If you set one up I'd love to join though

xSentry commented 6 months ago

There is a Discord I found: https://discord.gg/SDE66X9S