Reputation: 2053
I want to know if there is a way to get available languages from $translate
service and if there is a way display all the keys available in it.
I want to write a small tool that can shows easily differences between multiple translation resources files (json files).
i18n/fr.json
{
"title": "Mon titre",
"summary": "Mon beau résumé",
"submit": "Envoyer!"
}
i18n/en.json
{
"title": "My title",
"summary": "My summary",
"submit": "Submit!",
"contact": "Contact"
}
At the end, I want something like that :
╔══════════════╦═════════════╦═════════════════╗
║ keys ║ en ║ fr ║
╠══════════════╬═════════════╬═════════════════╣
║ home.contact ║ Contact ║ ############### ║
║ home.submit ║ Submit! ║ Envoyer! ║
║ home.summary ║ My summary ║ Mon beau résumé ║
║ home.title ║ My title ║ Mon titre ║
╚══════════════╩═════════════╩═════════════════╝
Upvotes: 0
Views: 4519
Reputation: 8404
Yes, there is
$translateProvider.translations();
You should get something like the folllowing (as JSON)
{
"en":{
"PAGE.MAIN":"Main page",
"PAGE.1":"Content page 1",
"PAGE.2":"Content page 2"
},
"fi":{
"PAGE.MAIN":"Pääsivu",
"PAGE.1":"Sisältösivu 1",
"PAGE.2":"Sisältösivu 2"
}
}
Upvotes: 3