adhearsion/voicemail — pull request #11 by JustinAiken (2013-08-30 20:52:22+00:00)
Title: Feature/add i18n

Initial i18n support. This will allow you to replace the greetings set in the config with i18n translations. Out of the box, this should allow you to configure dozens of languages with the same functionality as we currently have. (Well, mostly out of the box - you need to add an initializer to your project like this:

```ruby
I18n.load_path += Dir[File.join(config.platform.root, 'config', 'locales', '*.{rb,yml}').to_s]
I18n.default_locale = :en
```

Which I'll need to add to the docs... of course, if you're looking to enable i18n support in a plugin, you probably already have it in the rest of the app.

#### But wait!
here comes the kicker for moving forward...

Instead of just swapping out messages, I'd like to make it even more configurable. For example, here's the part of the code that currently plays the number of new messages you have.

```ruby
play config.mailbox.number_before
play_numeric number
play config.mailbox.number_after
```

Now we'll be able to have that in different languages... but what if we want that more changable? Maybe some users want the existing functionality, but other users would rather have the whole thing rendered as one TTS through i18n `"You have %count new message(s)"`.

I think we should think about how much customizability we want to add here... I think at the very least we need to be able to make it so we can pass a count in the number_after, so the i18n can handle pluralization.

Right now the `number_after` default is "` new messages`", and i18n or not, there's no way to change that to change it to `"new message."` if they have one message.

Perhaps this is a separate issue, but I think fixing the pluralization goes right along with allowing for i18n support...

Anyways, curious as to your thoughts @benlangfeld @bklang, as i18n needs to be added to adhearison core anyways...

One other possibility is just to make i18n hardcoded instead of an option - adhearsion loads activesupport which loads i18n, so the gem's there anyways...