Skip to content

Comma at the end of translations file causes strange behaviour #209

@DigitalLeaves

Description

@DigitalLeaves

Yesterday i18n stopped working all of a sudden for no apparent reason. After banging my head against a wall going through my code and trying to figure out when this had happened, I finally realized it is because when adding the last translation item in one language JSON file I had added a comma at the very end.

{
   "key_1": "value 1",
   "key_2": "value 2",
   ...,
   "key_n": "value n", <== here
}

I know JSON specification does not allow trailing commas, but I did not get a complaint or error message from i18n. I think there should be some kind of indication when the JSON files provided are wrong (which I think i18n probably does already?), but this case I think should be considered?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions