Browser Extension Translation

Interpr.it API

All API URLs are on the http://interpr.it/ domain. You should include your API key as a POST or GET parameter named api_key on every request.

/api/upload

Processes a zip file of your extension and saves any changes to your locales.

POST Parameters

  • package: A .zip file of your extension (or just its _locales/ directory and manifest.json file), as if it were uploaded via an HTML form. One way to achieve this is:

    curl -F "package=@myextension.zip" -F "api_key=ABCDEFG123" http://interpr.it/api/upload

Return Format

JSON

Example Return Values

  • { "status" : true, "extension_id" : 123 }

/api/download

Returns a .zip file of the latest locales directory for a given extension.

GET Parameters

  • extension_id: The ID of the extension, as seen in the URL of an extension's permalink page.

Return Format

.zip or .xpi file

/api/translate

Saves a translation of a message from an extension.

POST Parameters

  • extension_id: The ID of the extension, as seen in the URL of an extension's permalink page.
  • locale_code: The locale code of the translated message (a list of valid locale codes is available in Google's i18n documentation).
  • name: The name of the message being translated.
  • message: The translated message.

Return Format

JSON

Example Return Values

  • { "status" : true }
  • { "status" : false, "msg" : "That message doesn't exist in the default locale." }

/api/history

Returns a list of all of the changes to a message translation.

GET Parameters

  • extension_id: The ID of the extension, as seen in the URL of an extension's permalink page.
  • locale_code: The locale code of the translated message (a list of valid locale codes is available in Google's i18n documentation).
  • name: The name of the message being translated.

Return Format

JSON

Example Return Values

  • { 
    	"status" : true,
    	"history" : [
    		{ 
    			"history_id" : 123, 
    			"date" : "2010-01-02 03:04:05", 
    			"message" : "Hello world.", 
    			"user" : { 
    				"id" : 1, 
    				"username" : "cfinke", 
    				"permalink" : "/member/1"
    			}
    		},
    		{ 
    			"history_id" : 96, 
    			"date" : "2010-01-01 02:03:04", 
    			"message" : "Hello world!", 
    			"user" : { 
    				"id" : 2, 
    				"username" : "jsmith", 
    				"permalink" : "/member/2"
    			}
    		}
    	]
    }

/api/revert

Revert a translated string to an earlier revision.

POST Parameters

  • extension_id: The ID of the extension, as seen in the URL of an extension's permalink page.
  • locale_code: The locale code of the translated message (a list of valid locale codes is available in Google's i18n documentation).
  • name: The name of the message being translated.
  • history_id: The ID of the history entry, as returned by /api/history.

Return Format

JSON

Example Return Values

  • { "status" : true, "message" : "Hello world!" }

If you'd like to see more API methods made available, email chris@interpr.it.