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

README: Add new language development instruction #101

Closed
Tony763 opened this issue Mar 30, 2020 · 7 comments
Closed

README: Add new language development instruction #101

Tony763 opened this issue Mar 30, 2020 · 7 comments

Comments

@Tony763
Copy link
Contributor

Tony763 commented Mar 30, 2020

Hello, could somebody add list of necessary steps needed to begin with development of new language?

I did like to start with Czech language translation, but I miss steps for setting testing environment.
Something like:

  1. Install Mycroft from source
  2. Clone this repository to "location"
  3. Install requirements by running python3 setup.py install
  4. In "source" add code of your language to set is as supported.
  5. Copy these files and append language code to end.
  6. Do translations/changes and test them by ...
@ChanceNCounter
Copy link
Contributor

First of all, thank you and WELCOME! This repo can use all the love it can get from folks who are willing to help localize its modules.

I'm currently working on a refactor that will make it much, much easier to add new languages and localize existing functions. This is a WIP, but, if other collaborators agree to it, it should hopefully be merged within the next little while.

In the meantime - and this is the impetus for the refactor - you've got to do the following:

  1. Add corresponding test files in the lingua_franca/test/ directory (you'd have to do that anyway) and test them using pytest. I use VSCode, and I've got an extension for that. Similar extensions exist for other development environments. Also, when you do a PR here, CI will run tests, but it's good to test your own code before pushing.

  2. Note that the current top level functions have giant if/elif statements to call the localized functions (this is the main thing I wanna fix.) Add all your functions to those if/elif statements. These are the ones in format.py and parse.py that you actually call.

  3. Make sure your function signatures have all the arguments in the right order. You can skip trailing arguments you won't use. This, too, will hopefully be fixed, so that you can skip any names you won't use.

  4. If you name all your arguments the same as they're named in the English functions - lang/parse_en.py and lang/format_en.py - that will help with the localization. Not mandatory, it'd just be very, very nice of you.

I can't promise what I'm doing will be merged. It's a big change. However, if the thing is merged, all you'll have to do is name your files and function signatures correctly. So, if you want to start now and wait a little while to see if the structure gets simplified, you can work on your functions in isolation and call them directly.

There's a languages channel at Mycroft chat here if you want some guidance as you go. Most of the people who contribute to this repo hang out in that channel.

Lastly, everything I ever say can be overruled by a person with 'Mycroft' in their handle ;)

@krisgesling
Copy link
Contributor

Hey Tony,

Wanted to add that Lingua Franca is installed by default when you install Mycroft-core but for development you generally have this repo cloned elsewhere on your computer. You can use your changes in Mycroft by installing it in the Mycroft virtual environment.

If you added the Mycroft helper commands during setup you can just use:

mycroft-pip install /path/to/your/lingua-franca

Otherwise you need to:

cd ~/mycroft-core
source venv-activate.sh
pip install /path/to/your/lingua-franca

@Tony763
Copy link
Contributor Author

Tony763 commented Apr 3, 2020

@ChanceNCounter : Which pytest plugin you are using?

image

@ChanceNCounter
Copy link
Contributor

The third one. It gets its own tab in the editor.

@Tony763
Copy link
Contributor Author

Tony763 commented Apr 14, 2020

Step two is translate all basic skills downloaded to /opt/mycroft/skill aka mycroft-skills? Or there is something else?

@krisgesling
Copy link
Contributor

Lingua Franca is actually one of ~5 pieces needed to use Mycroft properly in another language. You can read more about all of those here:
https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/customizations/languages

The Skills translations are all managed at https://translate.mycroft.ai/ which are then pushed back to each Skills repository. However you can also edit anything locally on your machine at the directory you mentioned, though it's important to note that if you edit a Skill locally it will stop receiving updates as any remote update would overwrite the changes you've made locally.

@JarbasAl
Copy link
Collaborator

JarbasAl commented Nov 2, 2020

this has been fixed in latest release

thank you once again @ChanceNCounter

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

No branches or pull requests

4 participants