[FIXED] Unable to get content for non-US locales in models that are not locale-specificJune 16, 2019 at 1:53pm (Edited 7 months ago by @tom-voicehub)
I have a mixture of content models - some are locale-specific, and others are not. If I'm using a non en-US locale and attempt to lead content from one of my posts that doesn't have locale variations, I get an empty response back from Voicehub. If I haven't specified a locale in the content model, I'd expect that I'd get back that content for all locales.
June 17, 2019 at 7:49am
Hey , it would be of great help if you specifiy this issue a bit more. So you have a given post, of which the fields are non-localized, meaning they are only in your default locale. Correct so far? Then you are trying to request it with a locale that is not your default locale, you get an empty response? And this is with the SDK I assume?
Yes, that's correct. I get a response back, but if I look at the body of the response, I see that there is only an entry for my default locale (en-US). Since in my code I'm setting the Voicehub locale using voicehub.setLocale, it ends up extracting an empty response when I attempt to access the post. My situation is that I only have English locales. Some pieces of content does differ (e.g. I use "pounds" instead of "dollars" for en-GB responses), but other pieces of content is the same across all my supported locales. Rather than duplicate the content within Voicehub, I set up the content model to be locale-agnostic. Now, in my code, I want to be able to access to content without having to differentiate - I'd like to either get the locale-specific content if it exists, or fallback to the content provided if the model doesn't have entries per locale.
This makes perfect sense. I changed this in the SDK just now, please do an
npm upgrade [AT]voicehub/voicehub:) -- EDIT: since this spectrum is named voicehub, the messes with my markdown :D