Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pootle formats base delegation, models and classes #4966

Merged
merged 10 commits into from
Jul 28, 2016

Conversation

phlax
Copy link
Member

@phlax phlax commented Jul 25, 2016

Adds a pootle_formats app to register, retrieve and override format handling in Pootle

This is useful for implement multi-format projects #4929 and is also useful for implementing monolingual formats #4957


POOTLE_FORMATS = [
("po",
dict(title='Gettext PO file',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not need lazy localisation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it does - but i had added a unique_together with extension (to prevent menu duplication) so i should probs remove it in that case - maybe not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are displaying this title to the users then it must be localizable. If you want to keep a unique_together, something that makes sense because of all the formats that share the .properties extension, then I suggest adding an internal name that can be used for the unique check, like:

POOTLE_FORMATS = [
    ("po",
     dict(title=_('Gettext PO'),
          name='Gettext PO'
          extension="po",
          template_extension="pot")),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unho its unnecssary duplication - if you see in the code it has a name po

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also re localizing the title - as this is stored in the db my understanding is that this is not the place to localize (im happy to be wrong tho)

# AUTHORS file for copyright and authorship information.


POOTLE_FORMATS = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phlax why did you put too few formats? Should we link them with ttk formats?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any formats we add we will need proper support for. Im thinking initially it should just be po and xliff actually.

@phlax phlax added this to the 2.8.0b4 milestone Jul 27, 2016
@phlax phlax force-pushed the pootle_formats_base branch 5 times, most recently from df7d8d8 to b418e55 Compare July 28, 2016 16:23
@phlax phlax force-pushed the pootle_formats_base branch 2 times, most recently from 7603a02 to 868c567 Compare July 28, 2016 17:21
extension="xliff",
template_extension="xliff")),
("xlf",
dict(title='XLIFF Translation File',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you going to differentiate both XLIFF entries if they have the same title?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the title is always displayed with the extension - and there is a unique_together on them for that reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Displayed together in the UI like "Gettext PO file (.po)"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not seeing anything like that in 59d58aa#diff-99489b5e96e0f37f2daaa11c328f4d0dR31

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can add it further up the stack - probs on __str__ is a good idea actually - but for ref - here is where its actually used - https://github.com/translate/pootle/pull/4963/files#diff-83014e45acc5cd6424075fd6a8861be1R37

@phlax phlax force-pushed the pootle_formats_base branch 3 times, most recently from 2529668 to 4e87dda Compare July 28, 2016 18:53
@unho
Copy link
Member

unho commented Jul 28, 2016

lgtm

@phlax phlax merged commit 24d99e5 into translate:master Jul 28, 2016
@phlax phlax deleted the pootle_formats_base branch July 30, 2016 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants