From 37f7971b9f09c2008bfe8510470c8ecc6849654f Mon Sep 17 00:00:00 2001 From: Damien Date: Tue, 8 Jun 2021 13:36:46 +1000 Subject: [PATCH 1/7] Refresh of README to give more information about each template file --- README.md | 150 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 123 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 5d8bb23..4946b49 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Python Template for Flow Plugin -Just a Python Template Advice for Flow plugin, not a plugin. +This is a framework template for developing Flow Launcher plugins in Python. It logically breaks the code down into components and also includes tools to generate plugin information, test locally, and to allow for langauge localisation. -You can follow the template advice or not. But it could be better if you do. +It is not mandatory to use this template, however doing so helps standardize Python plugins and may assist in debugging. ## :bookmark: Versions @@ -11,19 +11,19 @@ You can follow the template advice or not. But it could be better if you do. ## :file_folder: File Structure -``` +``` . │ README.md │ LICENSE │ plugin.json │ .gitignore -│ .env # user config file +│ .env │ main.py │ test.py -| commands.py # commands for developer +| commands.py │ requirements.txt -| requirements-dev.txt # only for developer -| babel.cfg # `babel` config file +| requirements-dev.txt +| babel.cfg │ ├─assets │ example.png @@ -41,44 +41,140 @@ You can follow the template advice or not. But it could be better if you do. └─zh_CN ``` -## :sparkles: Features +## :open_file_folder: README.md + +The Github README markdown file for your plugin project. + +## :open_file_folder: LICENSE + +Update this file to outline the license for your plugin. + +## :open_file_folder: plugin.json + +The file that Flow uses to incorporate your plugin to the plugin manifest list. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commands.py]. + +## :open_file_folder: .gitignore + +Files for git to ignore when merging changes. + +## :open_file_folder: .env + +User config file. Currently sets the language for the plugin. The user will need to manually edit this once the plugin is installed to change the language (if you have localized the plugin. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commands.py]). + +## :open_file_folder: main.py + +The Python entry point to your plugin. You shouldn't have to edit this file. + +## :open_file_folder: test.py -### :desktop_computer: Commandas +A file that calls the Flowlauncher query via `main.py` and displays the results on the command line so you can debug. This file is for developing and doesn't need to be packaged with the plugin. -Using `click` to integrate the command function. +## :open_file_folder: commands.py -We can use the command to update `plugin.json` from the package itself. +This template uses the Python `click` package to parse the command line arguments for the different functions that `commands.py` can perform.. -Just like follow. +Those functions are: -``` +### gen-plugin-info + +```python python commands.py gen-plugin-info ``` -### :globe_with_meridians: Localizations - -Using `gettext` to integrate localization function. +We can use the `commands.py` to update `plugin.json` using the variables from the package itself. These are imported from `settings.py` in the **plugin** folder. -We can init a language like follow. +### init (localization) -``` +```python python commands.py init lang ``` -Then we can fill `.po` file in **translations** folder. +The next few functions allow you to use localization to translate strings in your plugin to different languages. You are not required to cater for more than one language but Flow Launcher is used around the world and many users appreciate being able to use it in their own language. If you need help translating to a language, try posting a request on the Discord server. -If something changed, you can take this to update the information. +Using `gettext` in your code you can integrate localization functionality.The [gettext documentation](https://docs.python.org/3/library/gettext.html#internationalizing-your-programs-and-modules) helps explain this but essentially you wrap any string with the default gettext tag (underscore and brackets) and the functions below will know to extract these out to be translated. For example: -``` +Regular string + +```python +self.sendNormalMess("Error - {}").format(my_err_string), "Check documentation for accepted units",) +``` + +Adding `gettext` tags to be able to translate both strings + +```python +self.sendNormalMess(_("Error - {}").format(my_err_string), _("Check documentation for accepted units"),) +``` + +We can initialize a language (en, zh, es, etc.) using the init function. This uses `babel.cfg` to know where and which files to search for the `gettext` strings. This will add these strings to a special text file - `messages.po` for each language in the **translations** folder. You can then edit this file to add in the specific string translations for that specific language. + +### update (localization) + +```python python commands.py update ``` -After all of this, we need to compile the `.po` to `.mo` file. +When you update your code, use this function to update the localization strings. -``` +### compile (localization) + +```python python commands.py compile ``` +Before shipping the plugin, we need to compile the `.po` file to a `.mo` file for each langauge with the compile function. + +## :open_file_folder: requirements.txt + +The Python package requirements for your plugin. Currently the user needs to manually install these once they have installed the plugin as Flow does no Python package management. The easiest way to do this is for the user to run. + +```powershell +pip install -r requirements.txt +``` + +## :open_file_folder: requirements-dev.txt + +Python package requirements for developers of your plugin. + +## :open_file_folder: babel.cfg + +Babel config file showing where to look for strings that can be translated. + +## :open_file_folder: assets\\example.png + +The assets folder are for any images, videos, or other assets for your plugin or Github README. In this case `example.png` is the example image for the default `README.md`. + +## :open_file_folder: assets\\favicon.png + +The icon for your plugin that appears in the query results. + +## :open_file_folder: plugin\\\_\_init\_\_.py + +The Python file that runs when you initialise the plugin. Pulls in settings and Main function. Code shouldn't need to be edited but you can update the comment to describe the plugin if you like. + +## :open_file_folder: plugin\\extensions.py + +Currently used for localization and shouldn't need to be edited unless you change where the localization files are stored. + +## :open_file_folder: plugin\\settings.py + +Edit this file to add in information for your plugin that is used throughout the code. Also uses the Python dotenv package to load the `.env` file for localization. + +## :open_file_folder: plugin\\templates.py + +Comes with templates for the JSONRPC query result and action. Other templates can be added here as you need them. + +## :open_file_folder: plugin\\ui.py + +The interaction with the FlowLauncher JSONRPC happens here. The Query function will have your main query logic. Most of your code and development will happen in this file and `utils.py`. + +## :open_file_folder: plugin\\utils.py + +This Python file will hold all your support functions for your plugin. + +## :open_file_folder: plugin\\translations\\\[LANGUAGE\]\\LC_MESSAGES + +These are your localization folders for each langauge your plugin supports. The template comes with English (US) and Chinese but you can add as many as you would like to support. The `po` and the `mo` files are described above. + ## :pushpin: Requirements - [`flowlauncher`](https://github.com/Flow-Launcher/Flow.Launcher.JsonRPC.Python) Flow's jsonRPC API for Python. It's **NECESSARY** for plugin. @@ -86,7 +182,7 @@ python commands.py compile ## :runner: ToDos -* [x] auto commands -* [x] local language -* [ ] inputs parser, for mulity inputs -* [ ] setting ui for Flow +- [x] auto commands +- [x] local language +- [ ] inputs parser, for multiple inputs +- [ ] setting ui for Flow From a90cb9e4454e0ccb457ff7e298a6fd6ca1609ee8 Mon Sep 17 00:00:00 2001 From: Damien Date: Tue, 8 Jun 2021 19:16:01 +1000 Subject: [PATCH 2/7] Update as per review comments for PR --- README.md | 74 ++++++++++++++++++------------------------------------- 1 file changed, 24 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 4946b49..257025c 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ It is not mandatory to use this template, however doing so helps standardize Pyt - [Flow](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master) - [Wox](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/wox) +## :pushpin: Requirements + +- [`flowlauncher`](https://github.com/Flow-Launcher/Flow.Launcher.JsonRPC.Python) Flow's jsonRPC API for Python. It's **NECESSARY** for plugin. +- `python-dotenv` User's config package. + ## :file_folder: File Structure ``` @@ -41,41 +46,31 @@ It is not mandatory to use this template, however doing so helps standardize Pyt └─zh_CN ``` -## :open_file_folder: README.md - -The Github README markdown file for your plugin project. +The following is some more detail on the important files. -## :open_file_folder: LICENSE - -Update this file to outline the license for your plugin. - -## :open_file_folder: plugin.json +### :open_file_folder: plugin.json The file that Flow uses to incorporate your plugin to the plugin manifest list. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commands.py]. -## :open_file_folder: .gitignore - -Files for git to ignore when merging changes. +### :open_file_folder: .env -## :open_file_folder: .env +User config file. Currently sets the language for the plugin. The user will need to manually edit this once the plugin is installed to change the language (if you have localized the plugin. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#open_file_folder-commands.py]). -User config file. Currently sets the language for the plugin. The user will need to manually edit this once the plugin is installed to change the language (if you have localized the plugin. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commands.py]). - -## :open_file_folder: main.py +### :open_file_folder: main.py The Python entry point to your plugin. You shouldn't have to edit this file. -## :open_file_folder: test.py +### :open_file_folder: test.py A file that calls the Flowlauncher query via `main.py` and displays the results on the command line so you can debug. This file is for developing and doesn't need to be packaged with the plugin. -## :open_file_folder: commands.py +### :open_file_folder: commands.py This template uses the Python `click` package to parse the command line arguments for the different functions that `commands.py` can perform.. Those functions are: -### gen-plugin-info +#### gen-plugin-info ```python python commands.py gen-plugin-info @@ -83,7 +78,7 @@ python commands.py gen-plugin-info We can use the `commands.py` to update `plugin.json` using the variables from the package itself. These are imported from `settings.py` in the **plugin** folder. -### init (localization) +#### :wrench: init (localization) ```python python commands.py init lang @@ -107,7 +102,7 @@ self.sendNormalMess(_("Error - {}").format(my_err_string), _("Check documentatio We can initialize a language (en, zh, es, etc.) using the init function. This uses `babel.cfg` to know where and which files to search for the `gettext` strings. This will add these strings to a special text file - `messages.po` for each language in the **translations** folder. You can then edit this file to add in the specific string translations for that specific language. -### update (localization) +#### update (localization) ```python python commands.py update @@ -115,7 +110,7 @@ python commands.py update When you update your code, use this function to update the localization strings. -### compile (localization) +#### compile (localization) ```python python commands.py compile @@ -123,7 +118,7 @@ python commands.py compile Before shipping the plugin, we need to compile the `.po` file to a `.mo` file for each langauge with the compile function. -## :open_file_folder: requirements.txt +### :open_file_folder: requirements.txt The Python package requirements for your plugin. Currently the user needs to manually install these once they have installed the plugin as Flow does no Python package management. The easiest way to do this is for the user to run. @@ -131,55 +126,34 @@ The Python package requirements for your plugin. Currently the user needs to man pip install -r requirements.txt ``` -## :open_file_folder: requirements-dev.txt - -Python package requirements for developers of your plugin. - -## :open_file_folder: babel.cfg +### :open_file_folder: babel.cfg Babel config file showing where to look for strings that can be translated. -## :open_file_folder: assets\\example.png - -The assets folder are for any images, videos, or other assets for your plugin or Github README. In this case `example.png` is the example image for the default `README.md`. - -## :open_file_folder: assets\\favicon.png - -The icon for your plugin that appears in the query results. - -## :open_file_folder: plugin\\\_\_init\_\_.py - -The Python file that runs when you initialise the plugin. Pulls in settings and Main function. Code shouldn't need to be edited but you can update the comment to describe the plugin if you like. - -## :open_file_folder: plugin\\extensions.py +### :open_file_folder: plugin\\extensions.py Currently used for localization and shouldn't need to be edited unless you change where the localization files are stored. -## :open_file_folder: plugin\\settings.py +### :open_file_folder: plugin\\settings.py Edit this file to add in information for your plugin that is used throughout the code. Also uses the Python dotenv package to load the `.env` file for localization. -## :open_file_folder: plugin\\templates.py +### :open_file_folder: plugin\\templates.py Comes with templates for the JSONRPC query result and action. Other templates can be added here as you need them. -## :open_file_folder: plugin\\ui.py +### :open_file_folder: plugin\\ui.py The interaction with the FlowLauncher JSONRPC happens here. The Query function will have your main query logic. Most of your code and development will happen in this file and `utils.py`. -## :open_file_folder: plugin\\utils.py +### :open_file_folder: plugin\\utils.py This Python file will hold all your support functions for your plugin. -## :open_file_folder: plugin\\translations\\\[LANGUAGE\]\\LC_MESSAGES +### :open_file_folder: plugin\\translations\\\[LANGUAGE\]\\LC_MESSAGES These are your localization folders for each langauge your plugin supports. The template comes with English (US) and Chinese but you can add as many as you would like to support. The `po` and the `mo` files are described above. -## :pushpin: Requirements - -- [`flowlauncher`](https://github.com/Flow-Launcher/Flow.Launcher.JsonRPC.Python) Flow's jsonRPC API for Python. It's **NECESSARY** for plugin. -- `python-dotenv` User's config package. - ## :runner: ToDos - [x] auto commands From d4a3475cb700da7798952a17132c279c51f49191 Mon Sep 17 00:00:00 2001 From: Zero Date: Wed, 9 Jun 2021 10:57:40 +0800 Subject: [PATCH 3/7] DOC: add title level with emoji --- README.md | 76 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 257025c..ad39b5a 100644 --- a/README.md +++ b/README.md @@ -48,29 +48,41 @@ It is not mandatory to use this template, however doing so helps standardize Pyt The following is some more detail on the important files. -### :open_file_folder: plugin.json +### :snake: Script File -The file that Flow uses to incorporate your plugin to the plugin manifest list. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commands.py]. +#### main.py -### :open_file_folder: .env +The Python entry point to your plugin. You shouldn't have to edit this file. -User config file. Currently sets the language for the plugin. The user will need to manually edit this once the plugin is installed to change the language (if you have localized the plugin. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#open_file_folder-commands.py]). +#### test.py -### :open_file_folder: main.py +A file that calls the Flowlauncher query via `main.py` and displays the results on the command line so you can debug. This file is for developing and doesn't need to be packaged with the plugin. -The Python entry point to your plugin. You shouldn't have to edit this file. +#### extensions.py -### :open_file_folder: test.py +Currently used for localization and shouldn't need to be edited unless you change where the localization files are stored. -A file that calls the Flowlauncher query via `main.py` and displays the results on the command line so you can debug. This file is for developing and doesn't need to be packaged with the plugin. +#### settings.py -### :open_file_folder: commands.py +Edit this file to add in information for your plugin that is used throughout the code. Also uses the Python dotenv package to load the `.env` file for localization. -This template uses the Python `click` package to parse the command line arguments for the different functions that `commands.py` can perform.. +#### templates.py -Those functions are: +Comes with templates for the JSONRPC query result and action. Other templates can be added here as you need them. + +#### ui.py + +The interaction with the FlowLauncher JSONRPC happens here. The Query function will have your main query logic. Most of your code and development will happen in this file and `utils.py`. -#### gen-plugin-info +#### utils.py + +This Python file will hold all your support functions for your plugin. + +#### :computer: commands.py + +This template uses the Python `click` package to parse the command line arguments for the different functions that `commands.py` can perform.. + +##### gen-plugin-info ```python python commands.py gen-plugin-info @@ -78,7 +90,9 @@ python commands.py gen-plugin-info We can use the `commands.py` to update `plugin.json` using the variables from the package itself. These are imported from `settings.py` in the **plugin** folder. -#### :wrench: init (localization) +##### :globe_with_meridians: Localization Commands + +###### init ```python python commands.py init lang @@ -102,7 +116,7 @@ self.sendNormalMess(_("Error - {}").format(my_err_string), _("Check documentatio We can initialize a language (en, zh, es, etc.) using the init function. This uses `babel.cfg` to know where and which files to search for the `gettext` strings. This will add these strings to a special text file - `messages.po` for each language in the **translations** folder. You can then edit this file to add in the specific string translations for that specific language. -#### update (localization) +###### update ```python python commands.py update @@ -110,7 +124,7 @@ python commands.py update When you update your code, use this function to update the localization strings. -#### compile (localization) +###### compile ```python python commands.py compile @@ -118,7 +132,10 @@ python commands.py compile Before shipping the plugin, we need to compile the `.po` file to a `.mo` file for each langauge with the compile function. -### :open_file_folder: requirements.txt + +### :package: Package File + +#### requirements.txt The Python package requirements for your plugin. Currently the user needs to manually install these once they have installed the plugin as Flow does no Python package management. The easiest way to do this is for the user to run. @@ -126,33 +143,28 @@ The Python package requirements for your plugin. Currently the user needs to man pip install -r requirements.txt ``` -### :open_file_folder: babel.cfg - -Babel config file showing where to look for strings that can be translated. - -### :open_file_folder: plugin\\extensions.py +#### plugin.json -Currently used for localization and shouldn't need to be edited unless you change where the localization files are stored. +The file that Flow uses to incorporate your plugin to the plugin manifest list. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commands.py]. -### :open_file_folder: plugin\\settings.py +### :wrench: Config File -Edit this file to add in information for your plugin that is used throughout the code. Also uses the Python dotenv package to load the `.env` file for localization. +#### .env -### :open_file_folder: plugin\\templates.py +User config file. Currently sets the language for the plugin. The user will need to manually edit this once the plugin is installed to change the language (if you have localized the plugin. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#open_file_folder-commands.py]). -Comes with templates for the JSONRPC query result and action. Other templates can be added here as you need them. +#### babel.cfg -### :open_file_folder: plugin\\ui.py +Babel config file showing where to look for strings that can be translated. -The interaction with the FlowLauncher JSONRPC happens here. The Query function will have your main query logic. Most of your code and development will happen in this file and `utils.py`. -### :open_file_folder: plugin\\utils.py +### :globe_with_meridians: Localization -This Python file will hold all your support functions for your plugin. +These are your localization folders for each langauge your plugin supports. -### :open_file_folder: plugin\\translations\\\[LANGUAGE\]\\LC_MESSAGES +`plugin\translations\[LANGUAGE]\LC_MESSAGES` -These are your localization folders for each langauge your plugin supports. The template comes with English (US) and Chinese but you can add as many as you would like to support. The `po` and the `mo` files are described above. +The template comes with English (US) and Chinese but you can add as many as you would like to support. The `po` and the `mo` files are described above. ## :runner: ToDos From 048524ded692dee273a3a13d75ed599e9306b860 Mon Sep 17 00:00:00 2001 From: Zero Date: Wed, 9 Jun 2021 11:35:49 +0800 Subject: [PATCH 4/7] DOC: update doc - a subject line with < 80 chars - add some notes - fix error link --- README.md | 120 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 97 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ad39b5a..0bad51a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ # Python Template for Flow Plugin -This is a framework template for developing Flow Launcher plugins in Python. It logically breaks the code down into components and also includes tools to generate plugin information, test locally, and to allow for langauge localisation. +This is a framework template for developing Flow Launcher plugins in Python. -It is not mandatory to use this template, however doing so helps standardize Python plugins and may assist in debugging. +It logically breaks the code down into components and also includes tools to +generate plugin information, test locally, and to allow for langauge localisation. + +It is not mandatory to use this template, +however doing so helps standardize Python plugins and may assist in debugging. ## :bookmark: Versions @@ -52,72 +56,121 @@ The following is some more detail on the important files. #### main.py -The Python entry point to your plugin. You shouldn't have to edit this file. +The Python entry point to your plugin (depend on `plugin.json`). + +You **shouldn't** have to edit this file. #### test.py -A file that calls the Flowlauncher query via `main.py` and displays the results on the command line so you can debug. This file is for developing and doesn't need to be packaged with the plugin. +A file that calls the Flowlauncher query via `main.py` and displays +the results on the command line so you can **debug**. + +This file is for developing and doesn't need to be packaged with the plugin. #### extensions.py -Currently used for localization and shouldn't need to be edited unless you change where the localization files are stored. +There is a example to show how to use the **3rd package**. + +Currently used for `localization` and shouldn't need to be edited unless +you change where the localization files are stored. #### settings.py -Edit this file to add in information for your plugin that is used throughout the code. Also uses the Python dotenv package to load the `.env` file for localization. +Edit this file to add in information for your plugin that is used throughout the code. + +Also uses `dotenv` to load the `.env` file for localization. #### templates.py -Comes with templates for the JSONRPC query result and action. Other templates can be added here as you need them. +Comes with templates for the JSON RPC query result and action. + +Other templates can be added here as you need them. #### ui.py -The interaction with the FlowLauncher JSONRPC happens here. The Query function will have your main query logic. Most of your code and development will happen in this file and `utils.py`. +The interaction with the Flow Launcher JSON RPC happens here. + +The `query` function will have your main query logic. + +Most of your code and development will happen in this file and `utils.py`. #### utils.py -This Python file will hold all your support functions for your plugin. +`ui.py` should only hold the UI logic to keep the main thought simple. + +`utils.py` could finish other function. #### :computer: commands.py -This template uses the Python `click` package to parse the command line arguments for the different functions that `commands.py` can perform.. +This template uses `click` to parse the command line arguments for +the different functions that `commands.py` can perform. ##### gen-plugin-info +Using Example: + ```python python commands.py gen-plugin-info ``` -We can use the `commands.py` to update `plugin.json` using the variables from the package itself. These are imported from `settings.py` in the **plugin** folder. +We can use the `commands.py` to update `plugin.json` using +the variables from the package itself. + +These are imported from `settings.py` in the **plugin** folder. ##### :globe_with_meridians: Localization Commands +The next few functions allow you to use localization to translate strings +in your plugin to different languages. + +You are not required to cater for more than one language but +Flow Launcher is used around the world and many users appreciate being able to +use it in their own language. + +If you need help translating to a language, try posting a request on the [Discord](https://discord.gg/AvgAQgh). + ###### init +Using Example: + ```python python commands.py init lang ``` -The next few functions allow you to use localization to translate strings in your plugin to different languages. You are not required to cater for more than one language but Flow Launcher is used around the world and many users appreciate being able to use it in their own language. If you need help translating to a language, try posting a request on the Discord server. +Using `gettext` in your code you can integrate localization functionality. + +The [gettext documentation](https://docs.python.org/3/library/gettext.html#internationalizing-your-programs-and-modules) +helps explain this but essentially you wrap any string with +the default gettext tag (underscore and brackets) and +the functions below will know to extract these out to be translated. -Using `gettext` in your code you can integrate localization functionality.The [gettext documentation](https://docs.python.org/3/library/gettext.html#internationalizing-your-programs-and-modules) helps explain this but essentially you wrap any string with the default gettext tag (underscore and brackets) and the functions below will know to extract these out to be translated. For example: +For example: Regular string ```python -self.sendNormalMess("Error - {}").format(my_err_string), "Check documentation for accepted units",) +self.sendNormalMess(f"Error - {my_err_string}", "Check documentation for accepted units") ``` Adding `gettext` tags to be able to translate both strings ```python -self.sendNormalMess(_("Error - {}").format(my_err_string), _("Check documentation for accepted units"),) +self.sendNormalMess(_(f"Error - {my_err_string}"), _("Check documentation for accepted units")) ``` -We can initialize a language (en, zh, es, etc.) using the init function. This uses `babel.cfg` to know where and which files to search for the `gettext` strings. This will add these strings to a special text file - `messages.po` for each language in the **translations** folder. You can then edit this file to add in the specific string translations for that specific language. +We can initialize a language (en, zh, es, etc.) using the init function. + +This uses `babel.cfg` to know where and which files to search for the `gettext` strings. + +This will add these strings to a special text file `messages.po` for each language +in the **translations** folder. + +You can then edit this file to add in the specific string translations for that specific language. ###### update +Using Example: + ```python python commands.py update ``` @@ -126,18 +179,27 @@ When you update your code, use this function to update the localization strings. ###### compile +Using Example: + ```python python commands.py compile ``` -Before shipping the plugin, we need to compile the `.po` file to a `.mo` file for each langauge with the compile function. - +Before shipping the plugin, we need to compile the `.po` file to a `.mo` file for +each langauge with the compile function. ### :package: Package File #### requirements.txt -The Python package requirements for your plugin. Currently the user needs to manually install these once they have installed the plugin as Flow does no Python package management. The easiest way to do this is for the user to run. +The Python package requirements for your plugin. + +Currently the user needs to manually install these +once they have installed the plugin as Flow does no Python package management. + +The easiest way to do this is for the user to run. + +Using Example: ```powershell pip install -r requirements.txt @@ -145,26 +207,38 @@ pip install -r requirements.txt #### plugin.json -The file that Flow uses to incorporate your plugin to the plugin manifest list. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commands.py]. +The file that Flow uses to incorporate your plugin to the plugin manifest list. + +See [commands.py](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commandspy). ### :wrench: Config File #### .env -User config file. Currently sets the language for the plugin. The user will need to manually edit this once the plugin is installed to change the language (if you have localized the plugin. See [https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#open_file_folder-commands.py]). +The user config file. + +You could change another name sound good for the **User**. + +Currently sets the language for the plugin. + +The user will need to manually edit this once the plugin is installed to change the language. + +If you have localized the plugin,please see [commands.py](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commandspy). #### babel.cfg Babel config file showing where to look for strings that can be translated. - ### :globe_with_meridians: Localization These are your localization folders for each langauge your plugin supports. `plugin\translations\[LANGUAGE]\LC_MESSAGES` -The template comes with English (US) and Chinese but you can add as many as you would like to support. The `po` and the `mo` files are described above. +The template comes with English (US) and Chinese but +you can add as many as you would like to support. + +The `po` and the `mo` files are described above. ## :runner: ToDos From bab7b15dadbfefd9d759ec3aeb9168e638ae43e9 Mon Sep 17 00:00:00 2001 From: Damien Date: Wed, 9 Jun 2021 16:39:41 +1000 Subject: [PATCH 5/7] Trying relative links within doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bad51a..7ac7bdb 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ pip install -r requirements.txt The file that Flow uses to incorporate your plugin to the plugin manifest list. -See [commands.py](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commandspy). +See [commands.py](#computer-commandspy). ### :wrench: Config File From 0a0a0d2fb646849d851dc6344d6f915888bcaded Mon Sep 17 00:00:00 2001 From: Damien Date: Wed, 9 Jun 2021 16:40:51 +1000 Subject: [PATCH 6/7] Updated second relative references --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ac7bdb..2fbde35 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,7 @@ Currently sets the language for the plugin. The user will need to manually edit this once the plugin is installed to change the language. -If you have localized the plugin,please see [commands.py](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commandspy). +If you have localized the plugin,please see [commands.py](#computer-commandspy). #### babel.cfg From fe8420dbfe011f72a128b9106a95810530c3cd88 Mon Sep 17 00:00:00 2001 From: Damien Date: Wed, 9 Jun 2021 17:50:21 +1000 Subject: [PATCH 7/7] Update as per review --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bad51a..7ac7bdb 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ pip install -r requirements.txt The file that Flow uses to incorporate your plugin to the plugin manifest list. -See [commands.py](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master#commandspy). +See [commands.py](#computer-commandspy). ### :wrench: Config File