cloudfoundry/cloud_controller_ng — pull request #292 by xingzhou (2014-09-10 08:23:12+00:00)
Title: Improve CC composite error message to support i18n

At present, in CC, there are some of the error messages are composite message
which consist of two parts: general message part and error detail reason part.
For example, Application Invalid message has three kinds of details:

1. Errors::ApiError.new_from_details("AppInvalid", "Number of instances less than 1")
2. Errors::ApiError.new_from_details("AppInvalid", "Invalid app state provided")
3. Errors::ApiError.new_from_details("AppInvalid", e.errors.full_messages)

For this kind of composite message, both the general message part and the detail
reason part need to be translated. Considering the details part is hard coded
in CC code, suggest to enhance the CC code like the following format to support
full i18n:

Errors::ApiError.new_from_details("AppInvalid.invalid_instance_number")

and in the i18n translation file, we can put the full message of AppInvalid error message like:

AppInvalid:
instances_less_than_1: "The app is invalid: Number of instances less than 1"
invalid_app_state: "The app is invalid: Invalid app state provided"
default: "The app is invalid: %s"

In this PR, I just use AppInvlid message as en example, if this solution is
ok for CC, we can use the same solution for other composite error messages
in CC code. Will submit following PRs after this one is accepted and merged.