jxmono / crud

:fork_and_knife: CRUD for mono
MIT License
0 stars 1 forks source link

Add i18n field support #9

Open gabipetrovay opened 11 years ago

gabipetrovay commented 11 years ago

When a field is marked as:

myField: {
    ...

    i18n: true
    ...
}

bind-crud should automatically save incoming values automatically with locales. For example, $set: { myField: "blah" } should be transformed into: $set: { "myField.de": "blah" } if the current locale is de.

The same when reading data. The current locale must change the find query. For example, { myField: "blah" } should be transformed into { "myField.de": "blah" }

Also the options must be scanned to adjust the i18n fields.

What happens if no locale? What is the default locale?

IonicaBizau commented 9 years ago

@gabipetrovay Wasn't this fixed?

gabipetrovay commented 9 years ago

Nope. :disappointed: It means crud to be aware of i18n fields and automatically save values in the correct locale if i18n is set for a field. Now we achieve this by explicitly adding the locale into the schema. Like here. But this approach creates some side effects (having to add the locale also in the label of the field and also having to either {custom hide the fields not in the users's locale} || {displaying all fields which generates clutter in the UI}).