Skip to content

Commit

Permalink
EB-108367 Modifying the get_project method to allow for different sou…
Browse files Browse the repository at this point in the history
…rce language codes

Summary: The get_project method used to always set English as the source language for a transifex project. This diff allows for different source language codes to be set.

Test Plan: N/A

Reviewers: bencornelis, colink, amatthews

Reviewed By: bencornelis, colink, amatthews

JIRA Issues: EB-109367

Differential Revision: https://phabricator.evbhome.com/D82805
  • Loading branch information
delaine-eb committed Apr 29, 2019
1 parent 97839fe commit 1e97e31
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/shuttle/transifex.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@ def projects(self):
project.Project._construct_path_to_collection()
)

def get_project(self, locale, **kwargs):
def get_project(self, locale, source_language_code=DEFAULT_SOURCE_LANGUAGE, **kwargs):
"""
Gets or creates the Transifex project for the current project prefix and locale
:param locale: A locale to which content is to be translated
:type locale: string
:param source_language_code: The language of the original untranslated content (i.e. Spanish),
defaults to DEFAULT_SOURCE_LANGUAGE, which is English
:type source_language_code: string, optional
:return: The Transifex project to which resources can be pushed or pulled
:rtype: project.Project
"""

try:
locale_project = project.Project.get(slug=self.get_project_slug(locale))
Expand All @@ -46,7 +57,7 @@ def get_project(self, locale, **kwargs):
'description': 'Help Center pages to translate to %s' % (
locale,
),
'source_language_code': DEFAULT_SOURCE_LANGUAGE,
'source_language_code': source_language_code,
'private': True,
}

Expand Down

0 comments on commit 1e97e31

Please sign in to comment.