Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null values in json #153

Closed
donseba opened this issue Jan 31, 2019 · 0 comments · Fixed by #166
Closed

null values in json #153

donseba opened this issue Jan 31, 2019 · 0 comments · Fixed by #166

Comments

@donseba
Copy link

donseba commented Jan 31, 2019

i'm using phraseApp for translations. and if I leave one of the pluralized values untranslated they will end up as null :

  "unknownTranslationMulti": {
    "one": null,
    "other": "Je hebt {{.Count}} berichten",
    "zero": null
  },

parsing this file will result on the following error on your end :

panic: expected value for key "zero" be a string but got <nil> [recovered]
	panic: expected value for key "zero" be a string but got <nil>

Is it possible to instead of throwing an error use the default specified in DefaultMessage ?

		DefaultMessage: &Message{
			ID:    "unknownTranslationMulti",
			Zero:  "You have no messages",
			One:   "You have {{.Count}} message",
			Other: "You have {{.Count}} messages",
		},

so basically merge them ?

And only for values that are null , if it is an actual empty string it hase been set deliberately to an empty value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant