Uh oh!
There was an error while loading. Please reload this page.
Handle hierarchy parent in flattening Loco resp - #27
Conversation
Nyholm
commented
Mar 8, 2016
Im.. But what if you have keys like Wouldn't that break everything? Or are we sure that that will return string "0", "1" and "2"? Also, if it not too much to ask, would you mind adding a small test for that function? |
damienalexandre
commented
Mar 8, 2016
I tried a bit more, and this is heavier than I thought, JSON and YML are just not up to the task 😢 Here is what Loco respond with JSON and YML: {
"navigation": {
"dropdown": {
"home": "Home",
"rent": {
"all_furnished": "All furnished rentals",
"luxury": "Luxury rentals",
"0": "Rentals",
"by_district": "Apartments by district",
"renting": "Renting in Paris",
"services": "Services and fees",
"more": "More informations"
}
}
},
"test": "<p>test<\/p>\n<p>qsd<\/p>\n<p>qsd<\/p>\n<p>qsd<\/p>\n<p> <\/p>"
}If I use INI, it's much better, no extra stuffs are added to my keys: ;; Loco php export: INI file (Symfony style);; Release: Working copy;; Locale: en-GB, ;; Status: Translated;; Exported by: Damien A;; Exported at: Tue, 08 Mar 2016 17:23:40 +0000navigation.dropdown.home = "Home"navigation.dropdown.rent.all_furnished = "All furnished rentals"navigation.dropdown.rent.luxury = "Luxury rentals"navigation.dropdown.rent = "Rentals"navigation.dropdown.rent.by_district = "Apartments by district"navigation.dropdown.rent.renting = "Renting in Paris"navigation.dropdown.rent.services = "Services and fees"navigation.dropdown.rent.more = "More informations"test = "<p>test</p><p>qsd</p><p>qsd</p><p>qsd</p><p> </p>"We need to ditch JSON for this API, or tell Loco to stop trying to "unflatten" translation keys, I started adding tests, but it doesn't help (oh goes puli is such a pain, it's needed when installing httplug/mock client...). |
Nyholm
commented
Mar 21, 2016
I would like to include @timwhitlock here. What is your input? Should we start using .INI files instead? |
timwhitlock
commented
Mar 21, 2016
You can avoid key folding by dropping the |
timwhitlock
commented
Mar 21, 2016
To avoid key folding in JSON you can specify |
When having keys like this:
Loco return a response like this:
One of the keys is zero, and my translation file is populated with
navigation.dropdown.rent.0.This PR fix this issue.