Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Refactor translations file to match model setup #547

Closed
billybonks opened this issue Jul 2, 2016 · 5 comments
Closed

Refactor translations file to match model setup #547

billybonks opened this issue Jul 2, 2016 · 5 comments
Labels
help wanted indicates that an issue is open for contributions localization wontfix indicates an issue/pull request will not be worked on

Comments

@billybonks
Copy link
Contributor

billybonks commented Jul 2, 2016

In order to have scalable, maintainable and clean translation files we should, model them according to their data models.

This means:

Every model should have it's name translated in singular and plural,
Every attribute should have a translation 1 to 1 relationship.
Model names could share the same namespace as attributes, but that could cause conflicts, so we would rather keep them seperate.

Take the following application models:

Model = Ember.Data.Model.extend({
  name: DS.string(),
  age:    DS.number(),
})
Model = Ember.Data.Model.extend({
  surname: DS.date(),
  age:    DS.number(),
})

The resultant translation file would look as follows:

models: {
  patient: {
    names: {
       singular: 'patient'
       plural: 'patients
    },
    labels: {
        firstName: 'First Name',
        lastName: 'Last Name'
     },
     placeholders: {
      firstName: 'Enter your first bame',
      lastName: 'Enter your first last Name'
     },
     hints: {
       firstName: 'This is the name that your parents gave you, unless you changed it',
       lastName: 'this is the name you share with your family, , unless you changed it'
     }
  },
  inventory: {
    names: {
      singular: 'inventory'
      plural: 'inventory items'
    },
    labels: {
      default: {
        name: 'Name',
        quantity: 'Quantity'
      }
    },
    placeholders: {
      name: 'Name of inventory item',
      quantity: 'Quantity of item'
     },
     hints: {
       name: 'What do you call',
       quantity: 'Go to storage and count :)'
     }
  }
}
@billybonks billybonks mentioned this issue Jul 4, 2016
@jkleinsc
Copy link
Member

jkleinsc commented Jul 6, 2016

@billybonks I think I'm in favor of this, but I think we should maybe make the prefixing a little clearer.
For example the path for attributes for the patients would be something like models.patient.name. For example:

models: {
  patient: {
    firstName: 'First Name',
    lastName: 'Last Name'
  },
  inventory: {
    name: 'Name',
    quantity: 'Quantity'
  }
}

The other thing to keep in mind is will it make sense for translators who aren't developers?

@billybonks
Copy link
Contributor Author

So i am up for your prefixing, if we agree, that the models won't share strings for their attributes. like startDate may appear in multiple places, but each place will have it's own string. There is definitely benefit in that, because it will allow each model attributes label to not be bound to another. just means more translations. but in theory if we use transfix it will help with that :).

@jkleinsc
Copy link
Member

jkleinsc commented Jul 7, 2016

@billybonks I absolutely agree we shouldn't share strings for attributes. Reusability is great for programming, but not so great for translations because context matters.

@tangollama tangollama added help wanted indicates that an issue is open for contributions localization labels Aug 6, 2016
@tangollama tangollama added Hack Day help wanted indicates that an issue is open for contributions and removed help wanted indicates that an issue is open for contributions labels Sep 17, 2016
@billybonks
Copy link
Contributor Author

@stale
Copy link

stale bot commented Aug 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix indicates an issue/pull request will not be worked on label Aug 7, 2019
@fox1t fox1t closed this as completed Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted indicates that an issue is open for contributions localization wontfix indicates an issue/pull request will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants