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

Add support for multiple languages #510

Merged
merged 6 commits into from
Feb 6, 2020

Conversation

davidcaron
Copy link
Contributor

@davidcaron davidcaron commented Feb 4, 2020

Overview

The 3 requests types are translated (GetCapabilities, DescribeProcess, Execute).

I translated only the title and abstract attributes for processes, inputs and outputs. Should something else be translated?

See the changes to docs/process.rst for an example of the interface.

Contribution Agreement

  • I'd like to contribute this feature to PyWPS. I confirm that my contributions to PyWPS will be compatible with the PyWPS license guidelines at the time of contribution.
  • I have already previously agreed to the PyWPS Contributions and Licensing Guidelines

translate title and abstract for processes, inputs and outputs
@davidcaron
Copy link
Contributor Author

davidcaron commented Feb 4, 2020

Codacy complains about mutable default arguments (not in this PR) and TravisCI fails because http://test.opendap.org/opendap is down right now...

@davidcaron
Copy link
Contributor Author

Here is an example of how we would add translations for a process and its inputs:

    from pywps import Process, LiteralInput, LiteralOutput


    class SayHello(Process):
        def __init__(self):
            inputs = [
                LiteralInput(
                    'name',
                    title='Input name',
                    abstract='The name to say hello to.',
                    translations={"fr-CA": {"abstract": "Le nom à saluer."}}
                )
            ],
            outputs=[
                LiteralOutput(
                    'response',
                    title='Output response',
                    abstract='The complete output message.',
                    translations={"fr-CA": {
                        "title": "La réponse", 
                        "abstract": "Le message complet."
                    }}
                )
            ],

            super().__init__(
                self._handler,
                identifier='say_hello',
                title='Process Say Hello',
                abstract='Returns a literal string output with Hello plus the inputed name',
                version='1.0',
                inputs=inputs,
                outputs=outputs,
                store_supported=True,
                status_supported=True,
                translations={"fr-CA": {
                    "title": "Processus Dire Bonjour", 
                    "abstract": "Retourne une chaine de caractères qui dit bonjour au nom fournit en entrée."
                }},
            )

@huard, do you think there could be a more intuitive way to specify the translations?

@huard
Copy link
Collaborator

huard commented Feb 4, 2020

@davidcaron I like the interface. It's close to the code, it obvious what to do. 👍

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 75.676% when pulling 6ac48ee on davidcaron:add-multiple-languages into a1c8502 on geopython:master.

Copy link
Collaborator

@cehbrecht cehbrecht left a comment

Choose a reason for hiding this comment

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

Looks good.

@cehbrecht
Copy link
Collaborator

tests are working now. I have checked for merge conflicts with PR #505 and there are none. Safe to merge.

@cehbrecht cehbrecht merged commit cbca3cf into geopython:master Feb 6, 2020
@cehbrecht
Copy link
Collaborator

@davidcaron merged. Thanks for adding this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants