L10n:Pontoon/API: Difference between revisions

m
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
==Description==


Exposing Pontoon's data through an API will enable external consumers to build tools, extensions and reports about translations.  In the future, the API will serve as the backend for Pontoon.NEXT's SPA front-end.  We chose an iterative approach to exposing the data.  We start small with a small number of clear-focused use-cases in mind and expand the scope in subsequent iterations.  The API is based on [http://graphql.org/ GraphQL] (see [https://wiki.mozilla.org/index.php?title=L10n:Pontoon/API&oldid=1181890#Technology discussion]).
Exposing Pontoon's data through an API will enable external consumers to build tools, extensions and reports about translations.  In the future, the API will serve as the backend for Pontoon.NEXT's front-end.  We chose an iterative approach to exposing the data.  We start small with a small number of clear-focused use-cases in mind and expand the scope in subsequent iterations.  The API is based on [http://graphql.org/ GraphQL] (see [https://wiki.mozilla.org/index.php?title=L10n:Pontoon/API&oldid=1181890#Technology discussion]).


==Overview==
==Overview==
Line 7: Line 7:
! style="text-align: center;" | Milestone
! style="text-align: center;" | Milestone
! style="text-align: center;" | Theme
! style="text-align: center;" | Theme
! style="text-align: center;" | Date
! style="text-align: center;" | Tracking bug
! style="text-align: center;" | Status
! style="text-align: center;" | Status
|-
|-
| M1
| M1
| Projects and Locales
| Projects and Locales
| September 2017
|
| ✓
| ✓
|-
|-
| M2
| M2
| Translations (Read-Only)
| User Notifications
| November 2017
| {{bug|1409704}}
|
|
|-
|-
| M3
| M3
| Translations (Write)
| Statistics over time
| January 2018
|
|
|
|-
|-
| M4
| M4
| User Notifications
| Contributors
| March 2018
|
|
|
|-
|-
| M5
| M5
| Contributors
| Translation Memory
| May 2018
|
|
|-
| M6
| Translations
|
|
|-
|-
|}
|}
[https://bugzilla.mozilla.org/enter_bug.cgi?assigned_to=nobody%40mozilla.org&bug_file_loc=http%3A%2F%2F&bug_ignored=0&bug_severity=normal&bug_status=NEW&cf_fx_iteration=---&cf_fx_points=---&cf_status_firefox56=---&cf_status_firefox57=---&cf_status_firefox58=---&cf_status_firefox_esr52=---&cf_tracking_firefox56=---&cf_tracking_firefox57=---&cf_tracking_firefox58=---&cf_tracking_firefox_esr52=---&cf_tracking_firefox_relnote=---&component=Pontoon&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&defined_groups=1&flag_type-4=X&flag_type-607=X&flag_type-800=X&flag_type-803=X&flag_type-916=X&form_name=enter_bug&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Unspecified&priority=--&product=Webtools&rep_platform=Unspecified&short_desc=%5BAPI%5D%20&target_milestone=---&version=Trunk File a new API bug.]
[https://bugzilla.mozilla.org/buglist.cgi?list_id=13836645&short_desc=%5BAPI%5D&columnlist=short_desc%2Cbug_status%2Cassigned_to%2Cblocked%2Cdependson&resolution=---&query_based_on=pontoon-api-open&query_format=advanced&short_desc_type=allwords&component=Pontoon&known_name=pontoon-api-open All open API bugs.]
[https://bugzilla.mozilla.org/showdependencytree.cgi?id=1395273&hide_resolved=1 Dependency tree for all milestones.]


==Roadmap==
==Roadmap==


===Milestone 1===
===Milestone 1: Projects and Locales===


''Complete, deployed on October 2, 2017.''  
''Complete, deployed on October 2, 2017.''  
Line 66: Line 53:
</bugzilla>
</bugzilla>


===Milestone 2===
===Milestone 2: User notifications===
 
Use-cases:
 
* [[L10n:Pontoon-Tools|Michal's Pontoon Tools extension]]
 
Queries:
 
* [[L10n:Pontoon-Tools#Data_sources|See Data sources section on the Pontoon Tools wiki]]
* Authentication (only return non-public data like notifications if the API consumer is authenticated)
 
===Milestone 3: Statistics over time===
 
Use-cases:
 
* Community Health, e.g.:
** Translation progress over time.
** Unreviewed suggestions progress over time.
 
Queries:
 
* [https://docs.google.com/document/d/1FlZLe8m2sFX6-AT9u_R8D4IODzcTNfx3d1QNaFzT1MQ/edit Get a number of strings per project within a period of time].
** Or a number of words.
 
===Milestone 4: Contributors===
 
Use-cases:
 
* [https://docs.google.com/spreadsheets/d/1-QWPJovsag4eYghkK2MMo30wa7QzOOMQkZdIjXnfZGQ/edit#gid=532595279 Number of user groups per locale].
 
Queries:
 
* Query a single contributor (by email? unique key?)
** List contributor data: email, display name, permissions, settings
** List recent activity: date, string, action
** Aggregate counts of: translated, unreviewed, fuzzy strings across all projects
** List of projects they contribute to
*** Aggregate counts of: translated, unreviewed, fuzzy strings for each project
* List all contributors on Pontoon
* List all contributors for a locale
* List all contributors for a project
* List all contributors for a localization (ProjectLocale)
 
===Milestone 5: Translation memory===
 
Use-cases:
 
* External services.
* Mozilla translators in non-Mozilla projects.
 
Queries:
 
* For a given source string, locale and minimum Levenshtein ratio, return a maximum number of results.


Main theme: read-only translations and pagination.
===Milestone 6: Translations===


Use-cases:
Use-cases:
Line 74: Line 113:
* Report translation status of a single page on mozilla.org
* Report translation status of a single page on mozilla.org
* Read-only data required by Pontoon.Next's Translate app
* Read-only data required by Pontoon.Next's Translate app
* Editing translations via Pontoon.Next's Translate app


Queries:
Queries:
Line 81: Line 121:
* List all Entities for a Resource.
* List all Entities for a Resource.
* List all Translations into a given Locale for an Entity.
* List all Translations into a given Locale for an Entity.
** Include status: approved, suggested, fuzzy.
** Include status: approved, unreviewed, fuzzy.
** Allow filtering on status via params?
** Allow filtering on status via params?
** List all Translations for an Entity
** List all Translations for an Entity
Line 88: Line 128:
** List all TranslatedResources for a Resource.
** List all TranslatedResources for a Resource.
** List all TranslatedResources for a Locale.
** List all TranslatedResources for a Locale.
* Add a translation for an Entity
** "approved" if the permissions are high enough
** "unreviewed" otherwise
* Approve/reject a suggestion.


<bugzilla>{
<bugzilla>{
Line 95: Line 139:
     "include_fields": "id, summary, status, resolution, priority, assigned_to"
     "include_fields": "id, summary, status, resolution, priority, assigned_to"
}</bugzilla>
}</bugzilla>
===Milestone 3===
Main theme: authenticated mutations.
Use-cases:
* Editing translations via Pontoon.Next's Translate app
Queries:
* Add a translation for an Entity
** "approved" if the permissions are high enough
** "suggested" otherwise
* Approve/reject a suggestion.
===Milestone 4===
Main theme: user notifications.
Use-cases:
* [https://github.com/MikkCZ/pontoon-tools/ Michal's Pontoon Tools extension]
Queries:
* List unread notifications for a logged-in user.
===Milestone 5===
Main theme: contributors.
* Query a single contributor (by email? unique key?)
** List recent activity: date, project, action, number of affected strings
** Aggregate counts of: translated, suggested, fuzzy strings across all projects
** List of projects they contribute to
*** Aggregate counts of: translated, suggested, fuzzy strings for each project
* List all contributors on Pontoon
* List all contributors for a locale
* List all contributors for a project
* List all contributors for a localization (ProjectLocale)
* One [https://docs.google.com/spreadsheets/d/1-QWPJovsag4eYghkK2MMo30wa7QzOOMQkZdIjXnfZGQ/edit#gid=532595279 common use case] from the past.


==Ideas==
==Ideas==
A list of ideas to consider for future milestones.
A list of ideas to consider for future milestones.
* Translation Memory. Input parameters: source string, locale, minimum Levenshtein ratio, maximum number of results.
* Statistics over time. [https://public.etherpad-mozilla.org/p/pontoon.api.historic.source.string.data Early rumblings and a use case].


==Contact==
==Contact==
Confirmed users
1,276

edits