diff --git a/v2/tools/release/release.go b/v2/tools/release/release.go index e6511d1cb..11d37c7fb 100644 --- a/v2/tools/release/release.go +++ b/v2/tools/release/release.go @@ -2,11 +2,12 @@ package main import ( "encoding/json" - "github.com/wailsapp/wails/v2/internal/s" "os" "os/exec" "strconv" "strings" + + "github.com/wailsapp/wails/v2/internal/s" ) const versionFile = "../../cmd/wails/internal/version.txt" @@ -61,15 +62,7 @@ func main() { s.ECHO("Removing old version: " + oldestVersion) s.CD("versioned_docs") s.RMDIR("version-" + oldestVersion) - s.CD("version-" + newVersion + "/gettingstarted") - s.REPLACEALL("firstproject.mdx", s.Sub{ - "../../src/components/frameworktabs": "../../../src/components/frameworktabs", - }) - s.REPLACEALL("installation.mdx", s.Sub{ - "../../src/components/tabinstall": "../../../src/components/tabinstall", - }) - - s.CD("../../../versioned_sidebars") + s.CD("../../versioned_sidebars") s.RM("version-" + oldestVersion + "-sidebars.json") } diff --git a/website/docs/gettingstarted/firstproject.mdx b/website/docs/gettingstarted/firstproject.mdx index 3af3ed856..c4a5f1d6c 100644 --- a/website/docs/gettingstarted/firstproject.mdx +++ b/website/docs/gettingstarted/firstproject.mdx @@ -2,6 +2,9 @@ sidebar_position: 2 --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + # Creating a Project ## Project Generation @@ -10,8 +13,74 @@ Now that the CLI is installed, you can generate a new project by using the `wail Pick your favourite framework: -import TabsFrameworks from "../../src/components/frameworktabs"; - + + + + + Generate a Svelte project using Javascript with:

+ + wails init -n myproject -t svelte +If you would rather use Typescript:
+ + wails init -n myproject -t svelte-ts +
+ + Generate a React project using Javascript with:

+ + wails init -n myproject -t react +If you would rather use Typescript:
+ + wails init -n myproject -t react-ts +
+ + Generate a Vue project using Javascript with:

+ + wails init -n myproject -t vue + +If you would rather use Typescript:
+ + wails init -n myproject -t vue-ts +
+ + Generate a Preact project using Javascript with:

+ + wails init -n myproject -t preact + +If you would rather use Typescript:
+ + wails init -n myproject -t preact-ts +
+ + Generate a Lit project using Javascript with:

+ + wails init -n myproject -t lit + +If you would rather use Typescript:
+ + wails init -n myproject -t lit-ts +
+ + Generate a Vanilla project using Javascript with:

+ + wails init -n myproject -t vanilla + +If you would rather use Typescript:
+ + wails init -n myproject -t vanilla-ts +
+
+ +
diff --git a/website/docs/gettingstarted/installation.mdx b/website/docs/gettingstarted/installation.mdx index b1dd17d9d..708e9c4cf 100644 --- a/website/docs/gettingstarted/installation.mdx +++ b/website/docs/gettingstarted/installation.mdx @@ -2,6 +2,9 @@ sidebar_position: 1 --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + # Installation ## Supported Platforms @@ -37,8 +40,40 @@ Run `npm --version` to verify. You will also need to install platform specific dependencies: -import TabsInstaller from "../../src/components/tabinstall"; - + + + + + Wails requires that the xcode command line tools are installed. This can be done by running:
+ xcode-select --install +
+ + Wails requires that the WebView2{" "} + runtime is installed. Some Windows installations will already have this installed. You can check using + the{" "} + wails doctor command (see below). + + + Linux required the standard gcc build tools + plus libgtk3 and libwebkit. + Rather than list a ton of commands for different distros, Wails can try to determine + what the installation commands are for your specific distribution. Run wails doctor after + installation + to be shown how to install the dependencies. + If your distro/package manager is not supported, please consult the {" "} + Add Linux Distro guide. + +
+ + ## Optional Dependencies diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 6e1706b36..138ae0e73 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -18,7 +18,7 @@ const config = { i18n: { defaultLocale: "en", - locales: ["en", "zh-Hans", "ja"], + locales: ["en", "zh-Hans", "ja", "ru"], localeConfigs: { en: { label: "English", @@ -30,6 +30,11 @@ const config = { direction: "ltr", htmlLang: "zh-Hans", }, + ru: { + label: "Русский", + direction: "ltr", + htmlLang: "ru-RU", + }, "ja": { label: "日本語", direction: "ltr", diff --git a/website/i18n/ja/code.json b/website/i18n/ja/code.json index a33ab839a..f06302b84 100644 --- a/website/i18n/ja/code.json +++ b/website/i18n/ja/code.json @@ -300,4 +300,4 @@ "message": "Toggle word wrap 文字列の折り返しの切替", "description": "The title attribute for toggle word wrapping button of code block lines" } -} \ No newline at end of file +} diff --git a/website/i18n/ja/docusaurus-plugin-content-blog/2021-09-27-v2-beta1-release-notes.mdx b/website/i18n/ja/docusaurus-plugin-content-blog/2021-09-27-v2-beta1-release-notes.mdx index faf33af62..101b71aa4 100644 --- a/website/i18n/ja/docusaurus-plugin-content-blog/2021-09-27-v2-beta1-release-notes.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-blog/2021-09-27-v2-beta1-release-notes.mdx @@ -10,7 +10,7 @@ tags:
- > +

@@ -31,7 +31,7 @@ No, I'm not joking: *No* *CGO* *dependency* 🤯! The thing about Windows is tha ### WebView2 Chromium Renderer
- > +

@@ -47,7 +47,7 @@ Gophers rejoice! The single binary dream lives on! ### New Features
- > +

@@ -59,7 +59,7 @@ There were a huge number of requests in v1 for the ability to have greater contr There is now the option to generate IDE configuration along with your project. This means that if you open your project in a supported IDE, it will already be configured for building and debugging your application. Currently VSCode is supported but we hope to support other IDEs such as Goland soon.
- > +

@@ -79,7 +79,7 @@ You just pass a single `embed.FS` that contains all your assets into your applic ### New Development Experience
- > +

@@ -101,7 +101,7 @@ In addition to this, another JS module is dynamically generated wrapping all you ### Remote Templates
- > +

diff --git a/website/i18n/ja/docusaurus-plugin-content-blog/2021-11-08-v2-beta2-release-notes.mdx b/website/i18n/ja/docusaurus-plugin-content-blog/2021-11-08-v2-beta2-release-notes.mdx index 7b1f38229..71967ef1b 100644 --- a/website/i18n/ja/docusaurus-plugin-content-blog/2021-11-08-v2-beta2-release-notes.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-blog/2021-11-08-v2-beta2-release-notes.mdx @@ -10,7 +10,7 @@ tags:
- > +

@@ -24,7 +24,7 @@ So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windo ### New Features
- > +

@@ -72,7 +72,7 @@ In addition to this, another JS module is dynamically generated wrapping all you ### Remote Templates
- > +

@@ -86,7 +86,7 @@ With v2, I wanted to empower the community by giving you the ability to create a Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the Wails project now supports M1 native builds:
- > +

@@ -94,7 +94,7 @@ Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the Wa You can also specify `darwin/amd64` as a target too:
- > +

@@ -102,7 +102,7 @@ You can also specify `darwin/amd64` as a target too: Oh, I almost forgot.... you can also do `darwin/universal`.... :wink:
- > +

@@ -112,7 +112,7 @@ Oh, I almost forgot.... you can also do `darwin/universal`.... :wink: Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
- > +

diff --git a/website/i18n/ja/docusaurus-plugin-content-blog/2022-02-22-v2-beta3-release-notes.mdx b/website/i18n/ja/docusaurus-plugin-content-blog/2022-02-22-v2-beta3-release-notes.mdx index fbff5a399..9282a11f4 100644 --- a/website/i18n/ja/docusaurus-plugin-content-blog/2022-02-22-v2-beta3-release-notes.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-blog/2022-02-22-v2-beta3-release-notes.mdx @@ -10,7 +10,7 @@ tags:
- > +

@@ -20,7 +20,7 @@ I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is so ### New Features
- > +

@@ -59,7 +59,7 @@ In addition to this, another JS module is dynamically generated wrapping all you ### Remote Templates
- > +

@@ -73,7 +73,7 @@ With v2, I wanted to empower the community by giving you the ability to create a Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
- > +

diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/building.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/building.mdx index 4532995ab..b48c9308d 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/building.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/building.mdx @@ -9,7 +9,7 @@ From the project directory, run `wails build`. This will compile your project an If you run the binary, you should see the default application:
- > +

diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx index 248139d12..55e972e87 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx @@ -2,6 +2,9 @@ sidebar_position: 2 --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + # Creating a Project ## Project Generation @@ -10,8 +13,75 @@ Now that the CLI is installed, you can generate a new project by using the `wail Pick your favourite framework: -import TabsFrameworks from "../../src/components/frameworktabs"; - + + + + + + Generate a Svelte project using Javascript with:

+ + wails init -n myproject -t svelte +If you would rather use Typescript:
+ + wails init -n myproject -t svelte-ts +
+ + Generate a React project using Javascript with:

+ + wails init -n myproject -t react +If you would rather use Typescript:
+ + wails init -n myproject -t react-ts +
+ + Generate a Vue project using Javascript with:

+ + wails init -n myproject -t vue + +If you would rather use Typescript:
+ + wails init -n myproject -t vue-ts +
+ + Generate a Preact project using Javascript with:

+ + wails init -n myproject -t preact + +If you would rather use Typescript:
+ + wails init -n myproject -t preact-ts +
+ + Generate a Lit project using Javascript with:

+ + wails init -n myproject -t lit + +If you would rather use Typescript:
+ + wails init -n myproject -t lit-ts +
+ + Generate a Vanilla project using Javascript with:

+ + wails init -n myproject -t vanilla + +If you would rather use Typescript:
+ + wails init -n myproject -t vanilla-ts +
+
+ +
diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx index e8e7cf72a..47cd48b8c 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx @@ -2,6 +2,9 @@ sidebar_position: 1 --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + # Installation ## Supported Platforms @@ -37,8 +40,40 @@ Run `npm --version` to verify. You will also need to install platform specific dependencies: -import TabsInstaller from "../../src/components/tabinstall"; - + + + + + Wails requires that the xcode command line tools are installed. This can be done by running:
+ xcode-select --install +
+ + Wails requires that the WebView2{" "} + runtime is installed. Some Windows installations will already have this installed. You can check using + the{" "} + wails doctor command (see below). + + + Linux required the standard gcc build tools + plus libgtk3 and libwebkit. + Rather than list a ton of commands for different distros, Wails can try to determine + what the installation commands are for your specific distribution. Run wails doctor after + installation + to be shown how to install the dependencies. + If your distro/package manager is not supported, please consult the {" "} + Add Linux Distro guide. + +
+ + ## Optional Dependencies diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/signing.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/signing.mdx index 6e16f5c5c..b4c9182c6 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/signing.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/signing.mdx @@ -313,7 +313,25 @@ jobs: with: node-version: 14 # You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json. - - name: Get Wails + jobs: + package: + strategy: + matrix: + platform: [ windows-latest, macos-latest ] + go-version: [1.18] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: setup node + uses: actions/setup-node@v2 + with: + node-version: 14 + # You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json. + - name: Get Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@latest - name: Build Wails app run: | @@ -329,33 +347,6 @@ jobs: # The certificates in a PKCS12 file encoded as a base64 string p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} # The password used to import the PKCS12 file. - p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} - - name: Sign our macOS binary - if: matrix.platform == 'macos-latest' - run: | - echo "Signing Package" - gon -log-level=info ./build/darwin/gon-sign.json - - name: Sign Windows binaries - if: matrix.platform == 'windows-latest' - run: | - echo "Creating certificate file" - New-Item -ItemType directory -Path certificate - Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}' - certutil -decode certificate\certificate.txt certificate\certificate.pfx - echo "Signing our binaries" - & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' .\build\bin\Monitor.exe - - name: upload artifacts macOS - if: matrix.platform == 'macos-latest' - uses: actions/upload-artifact@v2 - with: - name: wails-binaries-macos - path: build/bin/* - - name: upload artifacts windows - if: matrix.platform == 'windows-latest' - uses: actions/upload-artifact@v2 - with: - name: wails-binaries-windows - path: build/bin/* ``` # End notes diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/options.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/options.mdx index 15f017cac..b9d424e16 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/options.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/options.mdx @@ -669,7 +669,7 @@ func main() { The "About" menu item will appear in the app menu:
- > +

@@ -677,7 +677,7 @@ The "About" menu item will appear in the app menu: When clicked, that will open an about message box:
- > +

diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx index a27601992..ac795592c 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx @@ -154,9 +154,8 @@ selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{ ``` the first button is shown as default:
- > +
-
And if we specify `DefaultButton` to be "two": @@ -170,7 +169,7 @@ selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{ ``` the second button is shown as default. When `return` is pressed, the value "two" is returned.
- > +

@@ -187,7 +186,7 @@ selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{ ``` the button with "three" is shown at the bottom of the dialog. When `escape` is pressed, the value "three" is returned:
- > +

@@ -220,7 +219,7 @@ type FileFilter struct { Windows allows you to use multiple file filters in dialog boxes. Each FileFilter will show up as a separate entry in the dialog:
- > +

@@ -232,7 +231,7 @@ Windows allows you to use multiple file filters in dialog boxes. Each FileFilter Linux allows you to use multiple file filters in dialog boxes. Each FileFilter will show up as a separate entry in the dialog:
- > +

diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/tutorials/helloworld.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/tutorials/helloworld.mdx index 430f4f709..2a1246343 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/tutorials/helloworld.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/tutorials/helloworld.mdx @@ -107,6 +107,6 @@ You should see the application working as expected:
> + style={{"box-shadow": "rgb(255 255>>255 / 20%) 0px 1px 2px 0px, rgb(104 104 104) 0px 1px 5px 0px"}}/>

diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/version-v2.0.0-beta.38.json b/website/i18n/ja/docusaurus-plugin-content-docs/version-v2.0.0-beta.38.json new file mode 100644 index 000000000..c195ee101 --- /dev/null +++ b/website/i18n/ja/docusaurus-plugin-content-docs/version-v2.0.0-beta.38.json @@ -0,0 +1,30 @@ +{ + "version.label": { + "message": "v2.0.0-beta.38", + "description": "The label for version v2.0.0-beta.38" + }, + "sidebar.tutorialSidebar.category.Getting Started": { + "message": "Getting Started", + "description": "The label for category Getting Started in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Reference": { + "message": "Reference", + "description": "The label for category Reference in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Runtime": { + "message": "Runtime", + "description": "The label for category Runtime in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Community": { + "message": "Community", + "description": "The label for category Community in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Showcase": { + "message": "Showcase", + "description": "The label for category Showcase in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar tutorialSidebar" + } +} diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/version-v2.0.0-beta.39.json b/website/i18n/ja/docusaurus-plugin-content-docs/version-v2.0.0-beta.39.json new file mode 100644 index 000000000..50826a275 --- /dev/null +++ b/website/i18n/ja/docusaurus-plugin-content-docs/version-v2.0.0-beta.39.json @@ -0,0 +1,38 @@ +{ + "version.label": { + "message": "v2.0.0-beta.39", + "description": "The label for version v2.0.0-beta.39" + }, + "sidebar.tutorialSidebar.category.Getting Started": { + "message": "Getting Started", + "description": "The label for category Getting Started in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Reference": { + "message": "Reference", + "description": "The label for category Reference in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Runtime": { + "message": "Runtime", + "description": "The label for category Runtime in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Community": { + "message": "Community", + "description": "The label for category Community in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Showcase": { + "message": "Showcase", + "description": "The label for category Showcase in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Tutorials": { + "message": "Tutorials", + "description": "The label for category Tutorials in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Contributing": { + "message": "Contributing", + "description": "The label for category Contributing in sidebar tutorialSidebar" + } +} diff --git a/website/i18n/ru/code.json b/website/i18n/ru/code.json new file mode 100644 index 000000000..5285599fe --- /dev/null +++ b/website/i18n/ru/code.json @@ -0,0 +1,303 @@ +{ + "homepage.Features.Title1": { + "message": "Feature Rich" + }, + "homepage.Features.Description1": { + "message": "Build comprehensive cross-platform applications using native UI elements such as menus, dialogs, etc." + }, + "homepage.Features.Title2": { + "message": "Familiar" + }, + "homepage.Features.Description2": { + "message": "Use the technologies you already know to build amazing applications." + }, + "homepage.Features.Title3": { + "message": "Fast" + }, + "homepage.Features.Description3": { + "message": "Quickly generate, build and package your projects using the Wails CLI." + }, + "homepage.Tagline": { + "message": "Build beautiful cross-platform applications using Go" + }, + "homepage.ButtonText": { + "message": "Get Started" + }, + "homepage.LearnMoreButtonText": { + "message": "Learn More" + }, + "theme.ErrorPageContent.title": { + "message": "This page crashed.", + "description": "The title of the fallback page when the page crashed" + }, + "theme.ErrorPageContent.tryAgain": { + "message": "Try again", + "description": "The label of the button to try again when the page crashed" + }, + "theme.NotFound.title": { + "message": "Page Not Found", + "description": "The title of the 404 page" + }, + "theme.NotFound.p1": { + "message": "We could not find what you were looking for.", + "description": "The first paragraph of the 404 page" + }, + "theme.NotFound.p2": { + "message": "Please contact the owner of the site that linked you to the original URL and let them know their link is broken.", + "description": "The 2nd paragraph of the 404 page" + }, + "theme.AnnouncementBar.closeButtonAriaLabel": { + "message": "Close", + "description": "The ARIA label for close button of announcement bar" + }, + "theme.blog.archive.title": { + "message": "Archive", + "description": "The page & hero title of the blog archive page" + }, + "theme.blog.archive.description": { + "message": "Archive", + "description": "The page & hero description of the blog archive page" + }, + "theme.BackToTopButton.buttonAriaLabel": { + "message": "Scroll back to top", + "description": "The ARIA label for the back to top button" + }, + "theme.blog.paginator.navAriaLabel": { + "message": "Blog list page navigation", + "description": "The ARIA label for the blog pagination" + }, + "theme.blog.paginator.newerEntries": { + "message": "Newer Entries", + "description": "The label used to navigate to the newer blog posts page (previous page)" + }, + "theme.blog.paginator.olderEntries": { + "message": "Older Entries", + "description": "The label used to navigate to the older blog posts page (next page)" + }, + "theme.blog.post.readingTime.plurals": { + "message": "One min read|{readingTime} min read", + "description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.blog.post.readMoreLabel": { + "message": "Read more about {title}", + "description": "The ARIA label for the link to full blog posts from excerpts" + }, + "theme.blog.post.readMore": { + "message": "Read More", + "description": "The label used in blog post item excerpts to link to full blog posts" + }, + "theme.blog.post.paginator.navAriaLabel": { + "message": "Blog post page navigation", + "description": "The ARIA label for the blog posts pagination" + }, + "theme.blog.post.paginator.newerPost": { + "message": "Newer Post", + "description": "The blog post button label to navigate to the newer/previous post" + }, + "theme.blog.post.paginator.olderPost": { + "message": "Older Post", + "description": "The blog post button label to navigate to the older/next post" + }, + "theme.blog.sidebar.navAriaLabel": { + "message": "Blog recent posts navigation", + "description": "The ARIA label for recent posts in the blog sidebar" + }, + "theme.blog.post.plurals": { + "message": "One post|{count} posts", + "description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.blog.tagTitle": { + "message": "{nPosts} tagged with \"{tagName}\"", + "description": "The title of the page for a blog tag" + }, + "theme.tags.tagsPageLink": { + "message": "View All Tags", + "description": "The label of the link targeting the tag list page" + }, + "theme.CodeBlock.copyButtonAriaLabel": { + "message": "Copy code to clipboard", + "description": "The ARIA label for copy code blocks button" + }, + "theme.CodeBlock.copied": { + "message": "Copied", + "description": "The copied button label on code blocks" + }, + "theme.CodeBlock.copy": { + "message": "Copy", + "description": "The copy button label on code blocks" + }, + "theme.colorToggle.ariaLabel": { + "message": "Switch between dark and light mode (currently {mode})", + "description": "The ARIA label for the navbar color mode toggle" + }, + "theme.colorToggle.ariaLabel.mode.dark": { + "message": "dark mode", + "description": "The name for the dark color mode" + }, + "theme.colorToggle.ariaLabel.mode.light": { + "message": "light mode", + "description": "The name for the light color mode" + }, + "theme.docs.DocCard.categoryDescription": { + "message": "{count} items", + "description": "The default description for a category card in the generated index about how many items this category includes" + }, + "theme.docs.sidebar.expandButtonTitle": { + "message": "Expand sidebar", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.docs.sidebar.expandButtonAriaLabel": { + "message": "Expand sidebar", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.docs.paginator.navAriaLabel": { + "message": "Docs pages navigation", + "description": "The ARIA label for the docs pagination" + }, + "theme.docs.paginator.previous": { + "message": "Previous", + "description": "The label used to navigate to the previous doc" + }, + "theme.docs.paginator.next": { + "message": "Next", + "description": "The label used to navigate to the next doc" + }, + "theme.docs.sidebar.collapseButtonTitle": { + "message": "Collapse sidebar", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.collapseButtonAriaLabel": { + "message": "Collapse sidebar", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": { + "message": "Toggle the collapsible sidebar category '{label}'", + "description": "The ARIA label to toggle the collapsible sidebar category" + }, + "theme.docs.tagDocListPageTitle.nDocsTagged": { + "message": "One doc tagged|{count} docs tagged", + "description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.docs.tagDocListPageTitle": { + "message": "{nDocsTagged} with \"{tagName}\"", + "description": "The title of the page for a docs tag" + }, + "theme.docs.versionBadge.label": { + "message": "Version: {versionLabel}" + }, + "theme.docs.versions.unreleasedVersionLabel": { + "message": "This is unreleased documentation for {siteTitle} {versionLabel} version.", + "description": "The label used to tell the user that he's browsing an unreleased doc version" + }, + "theme.docs.versions.unmaintainedVersionLabel": { + "message": "This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.", + "description": "The label used to tell the user that he's browsing an unmaintained doc version" + }, + "theme.docs.versions.latestVersionSuggestionLabel": { + "message": "For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).", + "description": "The label used to tell the user to check the latest version" + }, + "theme.docs.versions.latestVersionLinkLabel": { + "message": "latest version", + "description": "The label used for the latest version suggestion link label" + }, + "theme.common.editThisPage": { + "message": "Edit this page", + "description": "The link label to edit the current page" + }, + "theme.common.headingLinkTitle": { + "message": "Direct link to heading", + "description": "Title for link to heading" + }, + "theme.lastUpdated.atDate": { + "message": " on {date}", + "description": "The words used to describe on which date a page has been last updated" + }, + "theme.lastUpdated.byUser": { + "message": " by {user}", + "description": "The words used to describe by who the page has been last updated" + }, + "theme.lastUpdated.lastUpdatedAtBy": { + "message": "Last updated{atDate}{byUser}", + "description": "The sentence used to display when a page has been last updated, and by who" + }, + "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": { + "message": "← Back to main menu", + "description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)" + }, + "theme.navbar.mobileVersionsDropdown.label": { + "message": "Versions", + "description": "The label for the navbar versions dropdown on mobile view" + }, + "theme.common.skipToMainContent": { + "message": "Skip to main content", + "description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation" + }, + "theme.tags.tagsListLabel": { + "message": "Tags:", + "description": "The label alongside a tag list" + }, + "theme.TOCCollapsible.toggleButtonLabel": { + "message": "On this page", + "description": "The label used by the button on the collapsible TOC component" + }, + "theme.navbar.mobileLanguageDropdown.label": { + "message": "Languages", + "description": "The label for the mobile language switcher dropdown" + }, + "theme.SearchBar.seeAll": { + "message": "See all {count} results" + }, + "theme.SearchBar.label": { + "message": "Search", + "description": "The ARIA label and placeholder for search button" + }, + "theme.SearchPage.documentsFound.plurals": { + "message": "One document found|{count} documents found", + "description": "Pluralized label for \"{count} documents found\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.SearchPage.existingResultsTitle": { + "message": "Search results for \"{query}\"", + "description": "The search page title for non-empty query" + }, + "theme.SearchPage.emptyResultsTitle": { + "message": "Search the documentation", + "description": "The search page title for empty query" + }, + "theme.SearchPage.inputPlaceholder": { + "message": "Type your search here", + "description": "The placeholder for search page input" + }, + "theme.SearchPage.inputLabel": { + "message": "Search", + "description": "The ARIA label for search page input" + }, + "theme.SearchPage.algoliaLabel": { + "message": "Search by Algolia", + "description": "The ARIA label for Algolia mention" + }, + "theme.SearchPage.noResultsText": { + "message": "No results were found", + "description": "The paragraph for empty search result" + }, + "theme.SearchPage.fetchingNewResults": { + "message": "Fetching new results...", + "description": "The paragraph for fetching new search results" + }, + "theme.tags.tagsPageTitle": { + "message": "Tags", + "description": "The title of the tag list page" + }, + "theme.docs.breadcrumbs.home": { + "message": "Home page", + "description": "The ARIA label for the home page in the breadcrumbs" + }, + "theme.docs.breadcrumbs.navAriaLabel": { + "message": "Breadcrumbs", + "description": "The ARIA label for the breadcrumbs" + }, + "theme.CodeBlock.wordWrapToggle": { + "message": "Toggle word wrap", + "description": "The title attribute for toggle word wrapping button of code block lines" + } +} diff --git a/website/i18n/ru/docusaurus-plugin-content-blog/2021-09-27-v2-beta1-release-notes.mdx b/website/i18n/ru/docusaurus-plugin-content-blog/2021-09-27-v2-beta1-release-notes.mdx new file mode 100644 index 000000000..101b71aa4 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-blog/2021-09-27-v2-beta1-release-notes.mdx @@ -0,0 +1,134 @@ +--- +slug: wails-v2-beta-for-windows +title: Wails v2 Beta for Windows +authors: + - leaanthony +tags: + - wails + - v2 +--- + + +
+ +
+ +
+ + +When I first announced Wails on Reddit, just over 2 years ago from a train in Sydney, I did not expect it to get much attention. A few days later, a prolific tech vlogger released a tutorial video, gave it a positive review and from that point on, interest in the project has skyrocketed. + +It was clear that people were excited about adding web frontends to their Go projects, and almost immediately pushed the project beyond the proof of concept that I had created. At the time, Wails used the [webview](https://github.com/webview/webview) project to handle the frontend, and the only option for Windows was the IE11 renderer. Many bug reports were rooted in this limitation: poor JavaScript/CSS support and no dev tools to debug it. This was a frustrating development experience but there wasn't much that could have been done to rectify it. + +For a long time, I'd firmly believed that Microsoft would eventually have to sort out their browser situation. The world was moving on, frontend development was booming and IE wasn't cutting it. When Microsoft announced the move to using Chromium as the basis for their new browser direction, I knew it was only a matter of time until Wails could use it, and move the Windows developer experience to the next level. + +Today, I am pleased to announce: **Wails v2 Beta for Windows**! There's a huge amount to unpack in this release, so grab a drink, take a seat and we'll begin... + +### No CGO Dependency! + +No, I'm not joking: *No* *CGO* *dependency* 🤯! The thing about Windows is that, unlike MacOS and Linux, it doesn't come with a default compiler. In addition, CGO requires a mingw compiler and there's a ton of different installation options. Removing the CGO requirement has massively simplified setup, as well as making debugging an awful lot easier. Whilst I have put a fair bit of effort in getting this working, the majority of the credit should go to [John Chadwick](https://github.com/jchv) for not only starting a couple of projects to make this possible, but also being open to someone taking those projects and building on them. Credit also to [Tad Vizbaras](https://github.com/tadvi) whose [winc](https://github.com/tadvi/winc) project started me down this path. + +### WebView2 Chromium Renderer + +
+ +
+ +
+ +Finally, Windows developers get a first class rendering engine for their applications! Gone are the days of contorting your frontend code to work on Windows. On top of that, you get a first-class developer tools experience! + +The WebView2 component does, however, have a requirement to have the `WebView2Loader.dll` sitting alongside the binary. This makes distribution just that little bit more painful than we gophers are used to. All solutions and libraries (that I know of) that use WebView2 have this dependency. + +However, I'm really excited to announce that Wails applications *have no such requirement*! Thanks to the wizardry of [John Chadwick](https://github.com/jchv), we are able to bundle this dll inside the binary and get Windows to load it as if it were present on disk. + +Gophers rejoice! The single binary dream lives on! + +### New Features + +
+ +
+ +
+ +There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators. + +There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs. + +There is now the option to generate IDE configuration along with your project. This means that if you open your project in a supported IDE, it will already be configured for building and debugging your application. Currently VSCode is supported but we hope to support other IDEs such as Goland soon. + +
+ +
+ +
+ +### No requirement to bundle assets + +A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS. + +> Wow, that sounds like a webserver... + +Yes, it works just like a webserver, except it isn't. + +> So how do I include my assets? + +You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you. + +### New Development Experience + +
+ +
+ +
+ + +Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk. + +It also provides the additional features: + + - Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend + - Auto rebuild - Any changes to your Go code will rebuild and relaunch your application + +In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change. + +In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate Typescript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds. + +In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code! + +### Remote Templates + +
+ +
+ +
+ +Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks. + +With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create! + +### In Conclusion + +Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome. Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board. + +There were many twists and turns, pivots and u-turns to get to this point. This was due partly to early technical decisions that needed changing, and partly because some core problems we had spent time building workarounds for were fixed upstream: Go’s embed feature is a good example. Fortunately, everything came together at the right time, and today we have the very best solution that we can have. I believe the wait has been worth it - this would not have been possible even 2 months ago. + +I also need to give a huge thank you :pray: to the following people because without them, this release just wouldn't exist: + +- [Misitebao](https://github.com/misitebao) - An absolute workhorse on the Chinese translations and an incredible bug finder. +- [John Chadwick](https://github.com/jchv) - His amazing work on [go-webview2](https://github.com/jchv/go-webview2) and [go-winloader](https://github.com/jchv/go-winloader) have made the Windows version we have today possible. +- [Tad Vizbaras](https://github.com/tadvi) - Experimenting with his [winc](https://github.com/tadvi/winc) project was the first step down the path to a pure Go Wails. +- [Mat Ryer](https://github.com/matryer) - His support, encouragement and feedback has really helped drive the project forward. + +And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the project in many ways behind the scenes. + +I look forward to seeing what people build with Wails in this next exciting phase of the project! + +Lea. + +PS: MacOS and Linux users need not feel left out - porting to this new foundation is actively under way and most of the hard work has already been done. Hang in there! + +PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks! diff --git a/website/i18n/ru/docusaurus-plugin-content-blog/2021-11-08-v2-beta2-release-notes.mdx b/website/i18n/ru/docusaurus-plugin-content-blog/2021-11-08-v2-beta2-release-notes.mdx new file mode 100644 index 000000000..71967ef1b --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-blog/2021-11-08-v2-beta2-release-notes.mdx @@ -0,0 +1,137 @@ +--- +slug: wails-v2-beta-for-mac +title: Wails v2 Beta for MacOS +authors: + - leaanthony +tags: + - wails + - v2 +--- + + +
+ +
+ +
+ +Today marks the first beta release of Wails v2 for Mac! It's taken quite a while to get to this point and I'm hoping that today's release will give you something that's reasonably useful. There have been a number of twists and turns to get to this point and I'm hoping, with your help, to iron out the crinkles and get the Mac port polished for the final v2 release. + +You mean this isn't ready for production? For your use case, it may well be ready, but there are still a number of known issues so keep your eye on [this project board](https://github.com/wailsapp/wails/projects/7) and if you would like to contribute, you'd be very welcome! + +So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windows Beta :wink: + +### New Features + +
+ +
+ +
+ +There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators. + +There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs. + +### Mac Specific Options + +In addition to the normal application options, Wails v2 for Mac also brings some Mac extras: + + - Make your window all funky and translucent, like all the pretty swift apps! + - Highly customisable titlebar + - We support the NSAppearance options for the application + - Simple config to auto-create an "About" menu + +### No requirement to bundle assets + +A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS. + +> Wow, that sounds like a webserver... + +Yes, it works just like a webserver, except it isn't. + +> So how do I include my assets? + +You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you. + +### New Development Experience + +Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk. + +It also provides the additional features: + + - Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend + - Auto rebuild - Any changes to your Go code will rebuild and relaunch your application + +In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change. + +In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate Typescript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds. + +In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code! + +### Remote Templates + +
+ +
+ +
+ +Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks. + +With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create! + +### Native M1 Support + +Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the Wails project now supports M1 native builds: + +
+ +
+ +
+ +You can also specify `darwin/amd64` as a target too: + +
+ +
+ +
+ +Oh, I almost forgot.... you can also do `darwin/universal`.... :wink: + +
+ +
+ +
+ +### Cross Compilation to Windows + +Because Wails v2 for Windows is pure Go, you can target Windows builds without docker. + +
+ +
+ +
+ + +### WKWebView Renderer + +V1 relied on a (now deprecated) WebView component. V2 uses the most recent WKWebKit component so expect the latest and greatest from Apple. + +### In Conclusion + +As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board. + +And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the project in many ways behind the scenes. + +I look forward to seeing what people build with Wails in this next exciting phase of the project! + +Lea. + +PS: Linux users, you're next! + +PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks! diff --git a/website/i18n/ru/docusaurus-plugin-content-blog/2022-02-22-v2-beta3-release-notes.mdx b/website/i18n/ru/docusaurus-plugin-content-blog/2022-02-22-v2-beta3-release-notes.mdx new file mode 100644 index 000000000..9282a11f4 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-blog/2022-02-22-v2-beta3-release-notes.mdx @@ -0,0 +1,96 @@ +--- +slug: wails-v2-beta-for-linux +title: Wails v2 Beta for Linux +authors: + - leaanthony +tags: + - wails + - v2 +--- + + +
+ +
+ +
+ +I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is somewhat ironic that the very first experiments with v2 was on Linux and yet it has ended up as the last release. That being said, the v2 we have today is very different from those first experiments. So without further ado, let's go over the new features: + +### New Features + +
+ +
+ +
+ +There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators. + +There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs. + +### No requirement to bundle assets + +A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS. + +> Wow, that sounds like a webserver... + +Yes, it works just like a webserver, except it isn't. + +> So how do I include my assets? + +You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you. + +### New Development Experience + +Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk. + +It also provides the additional features: + + - Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend + - Auto rebuild - Any changes to your Go code will rebuild and relaunch your application + +In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change. + +In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate Typescript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds. + +In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code! + +### Remote Templates + +
+ +
+ +
+ +Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks. + +With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create! + +### Cross Compilation to Windows + +Because Wails v2 for Windows is pure Go, you can target Windows builds without docker. + +
+ +
+ +
+ + +### In Conclusion + +As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board. + +Linux is **hard** to support. We expect there to be a number of quirks with the beta. Please help us to help you by filing detailed bug reports! + +Finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors) whose support drive the project in many ways behind the scenes. + +I look forward to seeing what people build with Wails in this next exciting phase of the project! + +Lea. + +PS: The v2 release isn't far off now! + +PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks! diff --git a/website/i18n/ru/docusaurus-plugin-content-blog/authors.yml b/website/i18n/ru/docusaurus-plugin-content-blog/authors.yml new file mode 100644 index 000000000..a1621fab6 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-blog/authors.yml @@ -0,0 +1,10 @@ +leaanthony: + name: Lea Anthony + title: Maintainer of Wails + url: https://github.com/leaanthony + image_url: https://github.com/leaanthony.png +misitebao: + name: Misite Bao + title: Architect + url: https://github.com/misitebao + image_url: https://github.com/misitebao.png diff --git a/website/i18n/ru/docusaurus-plugin-content-blog/options.json b/website/i18n/ru/docusaurus-plugin-content-blog/options.json new file mode 100644 index 000000000..9239ff706 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-blog/options.json @@ -0,0 +1,14 @@ +{ + "title": { + "message": "Blog", + "description": "The title for the blog used in SEO" + }, + "description": { + "message": "Blog", + "description": "The description for the blog used in SEO" + }, + "sidebar.title": { + "message": "Recent posts", + "description": "The label for the left sidebar" + } +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current.json b/website/i18n/ru/docusaurus-plugin-content-docs/current.json new file mode 100644 index 000000000..9bc66bdbd --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current.json @@ -0,0 +1,38 @@ +{ + "version.label": { + "message": "Next Version 🚧", + "description": "The label for version current" + }, + "sidebar.tutorialSidebar.category.Getting Started": { + "message": "Getting Started", + "description": "The label for category Getting Started in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Reference": { + "message": "Reference", + "description": "The label for category Reference in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Runtime": { + "message": "Runtime", + "description": "The label for category Runtime in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Community": { + "message": "Community", + "description": "The label for category Community in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Showcase": { + "message": "Showcase", + "description": "The label for category Showcase in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Tutorials": { + "message": "Tutorials", + "description": "The label for category Tutorials in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Contributing": { + "message": "Contributing", + "description": "The label for category Contributing in sidebar tutorialSidebar" + } +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/appendix/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/appendix/_category_.json new file mode 100644 index 000000000..83af4ca28 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/appendix/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Appendix", + "position": 70 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/_category_.json new file mode 100644 index 000000000..524986e1e --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Community", + "position": 50 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/links.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/links.mdx new file mode 100644 index 000000000..4a3a89e87 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/links.mdx @@ -0,0 +1,23 @@ +--- +sidebar_position: 2 +--- + +# Links + +This page serves as a list for community related links. Please submit a PR (click `Edit this page` at the bottom) to submit links. + +## Awesome Wails + +The [definitive list](https://github.com/wailsapp/awesome-wails) of links related to Wails. + +## Support Channels + +- [Gophers Slack Channel](https://gophers.slack.com/messages/CJ4P9F7MZ/) +- [Gophers Slack Channel Invite](https://invite.slack.golangbridge.org/) +- [Github Issues](https://github.com/wailsapp/wails/issues) +- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828) + +## Social Media + +- [Twitter](https://twitter.com/wailsapp) +- [Wails Chinese Community QQ Group](https://qm.qq.com/cgi-bin/qm/qr?k=PmIURne5hFGNd7QWzW5qd6FV-INEjNJv&jump_from=webapi) - Group number: 1067173054 diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/_category_.json new file mode 100644 index 000000000..276e283b7 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Showcase", + "position": 1 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/encrypteasy.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/encrypteasy.mdx new file mode 100644 index 000000000..31d7b6ad5 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/encrypteasy.mdx @@ -0,0 +1,10 @@ + +# EncryptEasy + +

+
+

+ +**[EncryptEasy](https://www.encrypteasy.app) is a simple and easy to use PGP encryption tool, managing all your and your contacts keys. Encryption should be simple. Developed with Wails.** + +Encrypting messages using PGP is the industry standard. Everyone has a private and a public key. Your private key, well, needs to be kept private so only you can read messages. Your public key is distributed to anyone who wants to send you secret, encrypted messages. Managing keys, encrypting messages and decrypting messages should be a smooth experience. EncryptEasy is all about making it easy. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/filehound.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/filehound.mdx new file mode 100644 index 000000000..9c3d7a921 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/filehound.mdx @@ -0,0 +1,14 @@ + +# FileHound Export Utility + +

+
+

+ +[FileHound Export Utility](https://www.filehound.co.uk/) FileHound is a cloud document management platform made for secure file retention, business process automation and SmartCapture capabilities. + +The FileHound Export Utility allows FileHound Administrators the ability to run a secure document and data extraction tasks for alternative back-up and recovery purposes. This application will download all documents and/or meta data saved in FileHound based on the filters you choose. The metadata will be exported in both JSON and XML formats. + +Backend built with: Go 1.15 Wails 1.11.0 go-sqlite3 1.14.6 go-linq 3.2 + +Frontend with: Vue 2.6.11 Vuex 3.4.0 Typescript Tailwind 1.9.6 diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/mollywallet.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/mollywallet.mdx new file mode 100644 index 000000000..b75238028 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/mollywallet.mdx @@ -0,0 +1,9 @@ + +# Molley Wallet + +

+
+

+ +[Molly Wallet](https://github.com/grvlle/constellation_wallet/) the official $DAG wallet of the Constellation Network. It'll let users interact with the Hypergraph Network in various ways, not limited to producing $DAG transactions. + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/october.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/october.mdx new file mode 100644 index 000000000..fbabff01e --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/october.mdx @@ -0,0 +1,11 @@ +# October + +

+
+

+ +[October](https://october.utf9k.net) is a small Wails application that makes it really easy to extract highlights from [Kobo eReaders](https://en.wikipedia.org/wiki/Kobo_eReader) and then forward them to [Readwise](https://readwise.io). + +It has a relatively small scope with all platform versions weighing in under 10MB, and that's without enabling [UPX compression](https://upx.github.io/)! + +In contrast, the author's previous attempts with Electron quickly bloated to several hundred megabytes. \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/optimus.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/optimus.mdx new file mode 100644 index 000000000..36cbf2fdf --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/optimus.mdx @@ -0,0 +1,9 @@ + +# Optimus + +

+
+

+ +[Optimus](https://github.com/splode/optimus) is a desktop image optimization application. It supports conversion and compression between WebP, JPEG, and PNG image formats. + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/portfall.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/portfall.mdx new file mode 100644 index 000000000..211009424 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/portfall.mdx @@ -0,0 +1,9 @@ + +# Portfall + +

+
+

+ +[Portfall](https://github.com/rekon-oss/portfall) - A desktop k8s port-forwarding portal for easy access to all your cluster UIs + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/restic-browser.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/restic-browser.mdx new file mode 100644 index 000000000..5642bb298 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/restic-browser.mdx @@ -0,0 +1,11 @@ + +# Restic Browser + +

+
+

+ +[Restic-Browser](https://github.com/emuell/restic-browser) - A simple, cross-platform [restic](https://github.com/restic/restic) backup GUI for browsing and restoring restic repositories. + + + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/riftshare.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/riftshare.mdx new file mode 100644 index 000000000..59680bdb3 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/riftshare.mdx @@ -0,0 +1,19 @@ + +# RiftShare + +

+
+

+ +Easy, Secure, and Free file sharing for everyone. Learn more at [Riftshare.app](https://riftshare.app) + +## Features + +* Easy secure file sharing between computers both in the local network and through the internet +* Supports sending files or directories securely through the [magic wormhole protocol](https://magic-wormhole.readthedocs.io/en/latest/) +* Compatible with all other apps using magic wormhole (magic-wormhole or wormhole-william CLI, wormhole-gui, etc.) +* Automatic zipping of multiple selected files to send at once +* Full animations, progress bar, and cancellation support for sending and receiving +* Native OS File Selection +* Open files in one click once received +* Auto Update - don't worry about having the latest release! diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/surge.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/surge.mdx new file mode 100644 index 000000000..b1693a6de --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/surge.mdx @@ -0,0 +1,9 @@ + +# Surge + +

+
+

+ +[Surge](https://getsurge.io/) is a p2p filesharing app designed to utilize blockchain technologies to enable 100% anonymous file transfers. Surge is end-to-end encrypted, decentralized and open source. + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/wally.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/wally.mdx new file mode 100644 index 000000000..3e842af40 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/wally.mdx @@ -0,0 +1,9 @@ + +# Wally + +

+
+

+ +[Wally](https://ergodox-ez.com/pages/wally) is the official firmware flasher for [Ergodox](https://ergodox-ez.com/) keyboards. It looks great and is a fantastic example of what you can achieve with Wails: the ability to combine the power of Go and the rich graphical tools of the web development world. + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/wombat.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/wombat.mdx new file mode 100644 index 000000000..38c482aac --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/wombat.mdx @@ -0,0 +1,9 @@ + +# Wombat + +

+
+

+ +[Wombat](https://github.com/rogchap/wombat) is a cross platform gRPC client. + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/ytd.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/ytd.mdx new file mode 100644 index 000000000..2e46d08ee --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/showcase/ytd.mdx @@ -0,0 +1,9 @@ + +# Ytd + +

+
+

+ +[Ytd](https://github.com/marcio199226/ytd/tree/v2-wails) is an app for downloading tracks from youtube, creating offline playlists and share them with your friends, your friends will be able to playback your playlists or download them for offline listening, has an built-in player. + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/community/templates.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/templates.mdx new file mode 100644 index 000000000..4d252644a --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/community/templates.mdx @@ -0,0 +1,48 @@ +--- +sidebar_position: 1 +--- + +# Templates + +This page serves as a list for community supported templates. Please submit a PR (click `Edit this page` at the bottom) to include your templates. To build your own template, please see the [Templates](../guides/templates.mdx) guide. + +To use these templates, run `wails init -n "Your Project Name" -t [the link below[@version]]` + +If there is no version suffix, the main branch code template is used by default. If there is a version suffix, the code template corresponding to the tag of this version is used. + +Example: `wails init -n "Your Project Name" -t https://github.com/misitebao/wails-template-vue` + +:::warning Attention + +**The Wails project does not maintain, is not responsible nor liable for 3rd party templates!** + +If you are unsure about a template, inspect `package.json` and `wails.json` for what scripts are run and what packages are installed. + +::: + +## Vue + +- [wails-template-vue](https://github.com/misitebao/wails-template-vue) - A template using Vite,Vue and Vue-Router(Support both JavaScript and TypeScript) +- [wails-vite-vue-ts](https://github.com/codydbentley/wails-vite-vue-ts) - Vue 3 TypeScript with Vite (and instructions to add features) +- [wails-vite-vue-the-works](https://github.com/codydbentley/wails-vite-vue-the-works) - Vue 3 TypeScript with Vite, Vuex, Vue Router, Sass, and ESLint + Prettier + +## Angular + +- [wails-angular-template](https://github.com/TAINCER/wails-angular-template) - Angular with TypeScript, Sass, Hot-Reload, Code-Splitting and i18n + +## React + +- [wails-react-template](https://github.com/AlienRecall/wails-react-template) - A template using reactjs +- [wails-react-template](https://github.com/flin7/wails-react-template) - A minimal template for React that supports live development +- [wails-template-nextjs](https://github.com/LGiki/wails-template-nextjs) - A template using Next.js and TypeScript + +## Svelte + +- [wails-svelte-template](https://github.com/raitonoberu/wails-svelte-template) - A template using Svelte +- [wails-vite-svelte-template](https://github.com/BillBuilt/wails-vite-svelte-template) - A template using Svelte and Vite +- [wails-vite-svelte-tailwind-template](https://github.com/BillBuilt/wails-vite-svelte-tailwind-template) - A template using Svelte and Vite with TailwindCSS v3 +- [wails-sveltekit-template](https://github.com/h8gi/wails-sveltekit-template) - A template using SvelteKit + +## Elm + +- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) - Develop your GUI app with functional programming and a **snappy** hot-reload setup :tada: :rocket: diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/_category_.json new file mode 100644 index 000000000..fad21931a --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Contributing", + "position": 99 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/developing-new-features.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/developing-new-features.mdx new file mode 100644 index 000000000..df3e22b67 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/developing-new-features.mdx @@ -0,0 +1,30 @@ +--- +sidebar_position: 20 +--- + +# Developing New Features + +We are always keen to add features to Wails and expand on what the project can do. The process for adding new features are as follows: + +- Pick an enhancement ticket with the "TODO" label. It's preferable to select one from the current [Backlog](https://github.com/orgs/wailsapp/projects/1/views/1) but the choice is yours. +- Before developing, check that the ticket includes the following information: +- The purpose of the enhancement +- What is out of scope for the enhancement +- What platforms the enhancement targets (most features should be cross-platform unless there's a very specific reason) +- If the ticket does not include this information, feel free to request the information from the person who opened the ticket. Sometimes placeholder tickets are created and require more details +- Comment on the ticket stating you wish to develop the feature +- Clone the repository and create a branch with the format `feature/_` +- New features often require documentation so please ensure you have also added or updated the documentation as part of the changes +- Once the feature is ready for testing, create a draft PR. Please ensure the PR description has the test scenarios and test cases listed with checkmarks, so that others can know what still needs to be tested. +- Once all the testing is completed, please update the status of the PR from draft and leave a message. + +:::note +There is nothing stopping you from opening a ticket and working on it yourself, but please be aware that all +enhancement requests are reviewed for good fit. Not all ideas will be selected so it's best to have discussion +on the ticket first. +::: + +:::warning +Any PRs opened without a corresponding ticket may be rejected. +::: + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/documenting.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/documenting.mdx new file mode 100644 index 000000000..6245f2aa3 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/documenting.mdx @@ -0,0 +1,27 @@ +--- +sidebar_position: 40 +--- + +# Documenting + +This website is also the main documentation site for the project. Sometimes this gets out of date and needs some slight adjustments. Some of the documentation isn't written to the best standards either. Developing documentation is hard and so any contribution to this is greatly appreciated. Features without documentation are unfinished so to the project, it's *as important* as the code. + +We generally do not create tickets for updating documentation so if there is text you think should be updated or rephrased then feel free to submit a PR for that. This site is in the main repository under the `website` directory. We use [Docusaurus](https://docusaurus.io/) to create the site so there is plenty of existing documentation and tutorials around to get started. + +To set up a local documentation development environment, do the following: + +- [Install npm](https://docs.npmjs.com/cli/v8/configuring-npm/install) +- `cd website` +- `npm install` +- `npm run start` + +After it has all installed and is running, you should see the site at [`http://localhost:3000`](http://localhost:3000). Any changes made to the site text will be immediately reflected in the browser. + +## Versioning + +We employ a versioning system where we have the "latest" documentation AKA "Next Version" which has all the changes that have occurred since the last release. We also keep the last release documentation as well as the version before that. + +There isn't usually a reason to update released documentation so we don't generally update the documents in the `versioned_docs` or `versioned_sidebars` directories. + +The "next version" docs are mainly in `website/docs` with some "version independent" documents in `src/pages`. Any updates should be made in the `website/docs` directory. + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/fixing-bugs.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/fixing-bugs.mdx new file mode 100644 index 000000000..65d2b2138 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/fixing-bugs.mdx @@ -0,0 +1,27 @@ +--- +sidebar_position: 30 +--- + +# Fixing Bugs + +The process for fixing bugs are as follows: + +- Check the current [Backlog](https://github.com/orgs/wailsapp/projects/1/views/1) and select a bug to fix +- Before developing, check that the ticket includes the following information: +- The scope of the issue including platforms affected +- The steps to reproduce. Sometimes bugs are opened that are not Wails issues and the onus is on the reporter to prove that it is a Wails issue with a minimal reproducible example +- The output of `wails doctor` +- If the ticket does not include this information, feel free to request the information from the person who opened the ticket. +- Comment on the ticket stating you wish to develop a fix +- Clone the repository and create a branch with the format `bugfix/_` +- Once the fix is ready for testing, create a draft PR. Please ensure the PR description has the test scenarios and test cases listed with checkmarks, so that others can know what still needs to be tested. +- Once all the testing is completed, please update the status of the PR from draft and leave a message. + +:::note +There is nothing stopping you from opening a ticket and working on it yourself, but please be aware that all +bugfixes should be discussed as the approach may have unintended side effects. +::: + +:::warning +Any PRs opened without a corresponding ticket may be rejected. +::: \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/helping-others.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/helping-others.mdx new file mode 100644 index 000000000..933c06b35 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/helping-others.mdx @@ -0,0 +1,13 @@ +--- +sidebar_position: 50 +--- + +# Helping Others + +A great way to contribute to the project is to help others who are experiencing difficulty. This is normally reported as a ticket or a message on the Wails slack channel. Even just clarifying the issue can really help out. Sometimes, when an issue is discussed and gets resolved, we create a guide out of it to help others who face the same issues. + +To join the Wails slack channel, accept the invite [here](https://gophers.slack.com/join/shared_invite/zt-197vymgt3-sJt4oyakb6nqlVKjXTyeVw#/shared-invite/email) and join us on the channel by following [this link](https://gophers.slack.com/?redir=%2Fmessages%2FCJ4P9F7MZ%2F). + +:::note +Work In Progress +::: diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/setting-up-a-dev-environment.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/setting-up-a-dev-environment.mdx new file mode 100644 index 000000000..b9f783229 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/setting-up-a-dev-environment.mdx @@ -0,0 +1,31 @@ +--- +sidebar_position: 10 +--- + +# Setting up a Development Environment + +You can set up a development environment by doing the following: + +- Install the latest versions of Go and Git +- `git clone https://github.com/wailsapp/wails` +- `cd wails/v2/cmd/wails` +- `go install` + +NOTE: The directory that you cloned the project into will now be called "clonedir". + +The Wails CLI will now be at the very latest version. + +To update projects to use the latest version, update the project's `go.mod` and ensure the following line is at the bottom of the file: + +`replace github.com/wailsapp/wails/v2 => ` + +Example: + +On Windows: `replace github.com/wailsapp/wails/v2 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2` + +On 'nix: `replace github.com/wailsapp/wails/v2 => /home/me/projects/wails/v2` + +To revert back to a stable version, run: + +`go install github.com/wailsapp/wails/v2/cmd/wails@latest` + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/testing.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/testing.mdx new file mode 100644 index 000000000..e751dfc3e --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/testing.mdx @@ -0,0 +1,16 @@ +--- +sidebar_position: 35 +--- + +# Testing + +Testing is vitally important to ensure quality in the project. There are a couple of scenarios where testing can really help the project: + +- Testing if a bug is reproducible on your local system +- Testing PRs to ensure that they work correctly + +If you chose to test if someone's bug report is reproducible on your local system, then feel free to add a comment on the ticket confirming this with the output of `wails doctor`. + +To test PRs, choose a PR to test and check if the PR description has the testing scenarios listed. If not, please ask the person who opened the PR to provide that list. Once you have determined a valid test scenario, please report your findings on the PR. + +If you ever need more clarity or help on testing, please ask a question in the [Contributing to Wails](https://github.com/wailsapp/wails/discussions/1520) discussion or on slack. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/ways-of-contributing.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/ways-of-contributing.mdx new file mode 100644 index 000000000..fd712438b --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/contributing/ways-of-contributing.mdx @@ -0,0 +1,18 @@ +--- +sidebar_position: 1 +--- + +# Ways of contributing + +Wails is an open source, community driven project. We welcome anyone to join us in contributing to the project. This documentation is aimed at anyone wishing to get familiar with the project and the development processes. + +There are many ways to contribute to the project: + +- Developing new features +- Fixing bugs +- Testing +- Documenting features +- Writing tutorials / guides +- Helping others on the issues + discussions boards + +Guides for these have been created in their own sections. Before getting started, please introduce yourself in the [Contributing to Wails](https://github.com/wailsapp/wails/discussions/1520) discussion. \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/_category_.json new file mode 100644 index 000000000..597b920df --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Getting Started", + "position": 10 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/building.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/building.mdx new file mode 100644 index 000000000..b48c9308d --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/building.mdx @@ -0,0 +1,19 @@ +--- +sidebar_position: 6 +--- + +# Compiling your Project + +From the project directory, run `wails build`. This will compile your project and save the production-ready binary in the `build/bin` directory. + +If you run the binary, you should see the default application: + +
+ +
+ +
+ + +For more details on compilation options, please refer to the [CLI Reference](../reference/cli.mdx#build). + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/development.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/development.mdx new file mode 100644 index 000000000..323e90ba9 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/development.mdx @@ -0,0 +1,16 @@ +--- +sidebar_position: 5 +--- + +# Developing your Application + +You can run your application in development mode by running `wails dev` from your project directory. This will do the following things: + + - Build your application and run it + - Bind your Go code to the frontend so it can be called from Javascript + - Using the power of [vite](https://vitejs.dev/), will watch for modifications in your Go files and rebuild/re-run on change + - Sets up a [webserver](http://localhost:34115) that will serve your application over a browser. This allows you to use your favourite browser extensions. You can even call your Go code from the console + +To get started, run `wails dev` in the project directory. More information on this can be found [here](../reference/cli.mdx#dev). + +Coming soon: Tutorial \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx new file mode 100644 index 000000000..1c0daa35b --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx @@ -0,0 +1,126 @@ +--- +sidebar_position: 2 +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Creating a Project + +## Project Generation + +Now that the CLI is installed, you can generate a new project by using the `wails init` command. + +Pick your favourite framework: + + + + + + + Generate a Svelte project using Javascript with:

+ + wails init -n myproject -t svelte +If you would rather use Typescript:
+ + wails init -n myproject -t svelte-ts +
+ + Generate a React project using Javascript with:

+ + wails init -n myproject -t react +If you would rather use Typescript:
+ + wails init -n myproject -t react-ts +
+ + Generate a Vue project using Javascript with:

+ + wails init -n myproject -t vue + +If you would rather use Typescript:
+ + wails init -n myproject -t vue-ts +
+ + Generate a Preact project using Javascript with:

+ + wails init -n myproject -t preact + +If you would rather use Typescript:
+ + wails init -n myproject -t preact-ts +
+ + Generate a Lit project using Javascript with:

+ + wails init -n myproject -t lit + +If you would rather use Typescript:
+ + wails init -n myproject -t lit-ts +
+ + Generate a Vanilla project using Javascript with:

+ + wails init -n myproject -t vanilla + +If you would rather use Typescript:
+ + wails init -n myproject -t vanilla-ts +
+
+ + + + +
+ +There are also [community templates](../community/templates.mdx) available that offer different capabilities and frameworks. + +To see the other options available, you can run `wails init -help`. More details can be found in the [CLI Reference](../reference/cli.mdx#init). + +## Project Layout + +Wails projects have the following layout: + +``` +. +├── build/ +│ ├── appicon.png +│ ├── darwin/ +│ └── windows/ +├── frontend/ +├── go.mod +├── go.sum +├── main.go +└── wails.json +``` + +### Project structure rundown + +- `/main.go` - The main application +- `/frontend/` - Frontend project files +- `/build/` - Project build directory +- `/build/appicon.png` - The application icon +- `/build/darwin/` - Mac specific project files +- `/build/windows/` - Windows specific project files +- `/wails.json` - The project configuration +- `/go.mod` - Go module file +- `/go.sum` - Go module checksum file + +The `frontend` directory has nothing specific to Wails and can be any frontend project of your choosing. + +The `build` directory is used during the build process. These files may be updated to customise your builds. If files are removed from the build directory, default versions will be regenerated. + +The default module name in `go.mod` is "changeme". You should change this to something more appropriate. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx new file mode 100644 index 000000000..1f5e89aa9 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx @@ -0,0 +1,94 @@ +--- +sidebar_position: 1 +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Installation + +## Supported Platforms + +- Windows 10/11 AMD64/ARM64 +- MacOS 10.13+ AMD64 +- MacOS 11.0+ ARM64 +- Linux AMD64/ARM64 + +## Dependencies + +Wails has a number of common dependencies that are required before installation: + +- Go 1.17+ +- NPM (Node 15+) + +### Go + +Download Go from the [Go Downloads Page](https://go.dev/doc/install). + +Ensure that you follow the official [Go installation instructions](https://go.dev/doc/install). You will also need to ensure that your `PATH` environment variable also includes the path to your `~/go/bin` directory. Restart your terminal and do the following checks: + +- Check Go is installed correctly: `go version` +- Check "~/go/bin" is in your PATH variable: `echo $PATH | grep go/bin` + +### NPM + +Download NPM from the [Node Downloads Page](https://nodejs.org/en/download/). It is best to use the latest release as that is what we generally test against. + +Run `npm --version` to verify. + +## Platform Specific Dependencies + +You will also need to install platform specific dependencies: + + + + + + + Wails requires that the xcode command line tools are installed. This can be done by running:
+ xcode-select --install +
+ + Wails requires that the WebView2{" "} + runtime is installed. Some Windows installations will already have this installed. You can check using + the{" "} + wails doctor command (see below). + + + Linux required the standard gcc build tools + plus libgtk3 and libwebkit. + Rather than list a ton of commands for different distros, Wails can try to determine + what the installation commands are for your specific distribution. Run wails doctor after + installation + to be shown how to install the dependencies. + If your distro/package manager is not supported, please consult the {" "} + Add Linux Distro guide. + +
+ + + + +## Optional Dependencies + +- [UPX](https://upx.github.io/) for compressing your applications. + +## Installing Wails + +Run `go install github.com/wailsapp/wails/v2/cmd/wails@latest` to install the Wails CLI. + +## System Check + +Running `wails doctor` will check if you have the correct dependencies installed. If not, it will advise on what is missing and help on how to rectify any problems. + +## The `wails` command appears to be missing? + +If your system is reporting that the `wails` command is missing, make sure you have followed the Go installation guide correctly. Normally, it means that the `go/bin` directory in your User's home directory is not in the `PATH` environment variable. You will also normally need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected at the command prompt. \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/_category_.json new file mode 100644 index 000000000..5935dad93 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Guides", + "position": 50 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/application-development.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/application-development.mdx new file mode 100644 index 000000000..43de983fa --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/application-development.mdx @@ -0,0 +1,197 @@ + +# Application Development + +There are no hard and fast rules for developing applications with Wails, but there are some basic guidelines. + +## Application Setup + +The pattern used by the default templates are that `main.go` is used for configuring and running the application, whilst `app.go` is used for defining the application logic. + +The `app.go` file will define a struct that has 2 methods which act as hooks into the main application: + +```go title="app.go" +type App struct { + ctx context.Context +} + +func NewApp() *App { + return &App{} +} + +func (a *App) startup(ctx context.Context) { + a.ctx = ctx +} + +func (a *App) shutdown(ctx context.Context) { +} +``` + +- The startup method is called as soon as Wails allocates the resources it needs and is a good place for creating resources, setting up event listeners and anything else the application needs at startup. It is given a `context.Context` which is usually saved in a struct field. This context is needed for calling the [runtime](../reference/runtime/intro.mdx). If this method returns an error, the application will terminate. In dev mode, the error will be output to the console. + +- The shutdown method will be called by Wails right at the end of the shutdown process. This is a good place to deallocate memory and perform any shutdown tasks. + +The `main.go` file generally consists of a single call to `wails.Run()`, which accepts the application configuration. The pattern used by the templates is that before the call to `wails.Run()`, an instance of the struct we defined in `app.go` is created and saved in a variable called `app`. This configuration is where we add our callbacks: + +```go {3,9,10} title="main.go" +func main() { + + app := NewApp() + + err := wails.Run(&options.App{ + Title: "My App", + Width: 800, + Height: 600, + OnStartup: app.startup, + OnShutdown: app.shutdown, + }) + if err != nil { + log.Fatal(err) + } +} + +``` + +More information on application lifecycle hooks can be found [here](../howdoesitwork.mdx#application-lifecycle-callbacks). + +## Binding Methods + +It is likely that you will want to call Go methods from the frontend. This is normally done by adding public methods to the already defined struct in `app.go`: + +```go {16-18} title="app.go" +type App struct { + ctx context.Context +} + +func NewApp() *App { + return &App{} +} + +func (a *App) startup(ctx context.Context) { + a.ctx = ctx +} + +func (a *App) shutdown(ctx context.Context) { +} + +func (a *App) Greet(name string) string { + return fmt.Sprintf("Hello %s!", name) +} +``` + +In the main application configuration, the `Bind` key is where we can tell Wails what we want to bind: + +```go {11-13} title="main.go" +func main() { + + app := NewApp() + + err := wails.Run(&options.App{ + Title: "My App", + Width: 800, + Height: 600, + OnStartup: app.startup, + OnShutdown: app.shutdown, + Bind: []interface{}{ + app, + }, + }) + if err != nil { + log.Fatal(err) + } +} + +``` + +This will bind all public methods in our `App` struct (it will never bind the startup and shutdown methods). + +### Dealing with context when binding multiple structs + +If you want to bind methods for multiple structs but want each struct to keep a reference to the context so that you can use the runtime functions, a good pattern is to pass the context from the `OnStartup` method to your struct instances : + +```go +func main() { + + app := NewApp() + otherStruct := NewOtherStruct() + + err := wails.Run(&options.App{ + Title: "My App", + Width: 800, + Height: 600, + OnStartup: func(ctx context.Context){ + app.SetContext(ctx) + otherStruct.SetContext(ctx) + }, + OnShutdown: app.shutdown, + Bind: []interface{}{ + app, + otherStruct + }, + }) + if err != nil { + log.Fatal(err) + } +} +``` + + + +More information on Binding can be found [here](../howdoesitwork.mdx#method-binding). + +## Application Menu + +Wails supports adding a menu to your application. This is done by passing a [Menu](../reference/menus.mdx#menu) struct to application config. It's common to use a method that returns a Menu, and even more common for that to be a method on the `App` struct used for the lifecycle hooks. + +```go {11} title="main.go" +func main() { + + app := NewApp() + + err := wails.Run(&options.App{ + Title: "My App", + Width: 800, + Height: 600, + OnStartup: app.startup, + OnShutdown: app.shutdown, + Menu: app.menu(), + Bind: []interface{}{ + app, + }, + }) + if err != nil { + log.Fatal(err) + } +} + +``` + +## Assets + +The great thing about the way Wails v2 handles assets is that it doesn't! The only thing you need to give Wails is an `embed.FS`. How you get to that is entirely up to you. You can use vanilla html/css/js files like the vanilla template. You could have some complicated build system, it doesn't matter. + +When `wails build` is run, it will check the `wails.json` project file at the project root. There are 2 keys in the project file that are read: + +- "frontend:install" +- "frontend:build" + +The first, if given, will be executed in the `frontend` directory to install the node modules. The second, if given, will be executed in the `frontend` directory to build the frontend project. + +If these 2 keys aren't given, then Wails does absolutely nothing with the frontend. It is only expecting that `embed.FS`. + +### AssetsHandler + +A Wails v2 app can optionally define a `http.Handler` in the `options.App`, which allows hooking into the AssetServer to create files on the fly or process POST/PUT requests. GET requests are always first handled by the `assets` FS. If the FS doesn't find the requested file the request will be forwarded to the `http.Handler` for serving. Any requests other than GET will be directly processed by the `AssetsHandler` if specified. It's also possible to only use the `AssetsHandler` by specifiy `nil` as the `Assets` option. + +## Built in Dev Server + +Running `wails dev` will start the built in dev server which will start a file watcher in your project directory. By default, if any file changes, wails checks if it was an application file (default: `.go`, configurable with `-e` flag). If it was, then it will rebuild your application and relaunch it. If the changed file was in the assets, it will issue a reload after a short amount of time. + +The dev server uses a technique called "debouncing" which means it doesn't reload straight away, as there may be multiple files changed in a short amount of time. When a trigger occurs, it waits for a set amount of time before issuing a reload. If another trigger happens, it resets to the wait time again. By default this value is `100ms`. If this value doesn't work for your project, it can be configured using the `-debounce` flag. If used, this value will be saved to your project config and become the default. + +## External Dev Server + +Some frameworks come with their own live-reloading server, however they will not be able to take advantage of the Wails Go bindings. In this scenario, it is best to run a watcher script that rebuilds the project into the build directory, which Wails will be watching. For an example, see the default svelte template that uses [rollup](https://rollupjs.org/guide/en/). For [create-react-app](https://create-react-app.dev/), it's possible to use [this script](https://gist.github.com/int128/e0cdec598c5b3db728ff35758abdbafd) to achieve a similar result. + +## Go Module + +The default Wails templates generate a `go.mod` file that contains the module name "changeme". You should change this to something more appropriate after project generation. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/bleeding-edge.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/bleeding-edge.mdx new file mode 100644 index 000000000..3e62a2ced --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/bleeding-edge.mdx @@ -0,0 +1,48 @@ + +# Bleeding Edge + +## Overview + +Wails is in constant development and new releases are regularly "tagged". This usually happens when all the newer code on `master` has been tested and confirmed working. If you need a bugfix or feature that has not yet made it to a release, it's possible to use the latest "bleeding edge" version using the following steps: + +- `git clone https://github.com/wailsapp/wails` +- `cd wails/v2/cmd/wails` +- `go install` + +NOTE: The directory that you cloned the project into will now be called "clonedir". + +The Wails CLI will now be at the very latest version. To update projects to use the latest version, update the project's `go.mod` and ensure the following line is at the bottom of the file: + +`replace github.com/wailsapp/wails/v2 => ` + +Example: + +On Windows: `replace github.com/wailsapp/wails/v2 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2` + +On 'nix: `replace github.com/wailsapp/wails/v2 => /home/me/projects/wails/v2` + +To revert back to a stable version, run: + +`go install github.com/wailsapp/wails/v2/cmd/wails@latest` + +## Testing a Branch + +If you want to test a branch, follow the instructions above, but ensure you switch the branch you want to test before installing: + +- `git clone https://github.com/wailsapp/wails` +- `cd wails` +- `git checkout -b branch-to-test --track origin/branch-to-test` +- `cd v2/cmd/wails` +- `go install` + +## Testing a PR + +If you want to test a PR, follow the instructions above, but ensure you fetch the PR and switch the branch before installing. Please replace `[IDofThePR]` with the ID of the PR shown on github.com: + +- `git clone https://github.com/wailsapp/wails` +- `cd wails` +- `git fetch -u origin pull/[IDofThePR]/head:test/pr-[IDofThePR]` +- `git checkout test/pr-[IDofThePR]` +- `git reset --hard HEAD` +- `cd v2/cmd/wails` +- `go install` diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx new file mode 100644 index 000000000..9fd0f1d30 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx @@ -0,0 +1,116 @@ +# Dynamic Assets + +If you want to load or generate assets for your frontend dynamically, you can achieve that using the [AssetsHandler](../reference/options#assetshandler) option. The AssetsHandler is a generic `http.Handler` which will be called for any non GET request on the assets server and for GET requests which can not be served from the bundled assets because the file is not found. + +By installing a custom AssetsHandler, you can serve your own assets using a custom asset server. + +## Example + +In our example project, we will create a simple assets handler which will load files off disk: + +```go title=main.go {16-35,49} +package main + +import ( + "embed" + "fmt" + "github.com/wailsapp/wails/v2" + "github.com/wailsapp/wails/v2/pkg/options" + "net/http" + "os" + "strings" +) + +//go:embed frontend/dist +var assets embed.FS + +type FileLoader struct { + http.Handler +} + +func NewFileLoader() *FileLoader { + return &FileLoader{} +} + +func (h *FileLoader) ServeHTTP(res http.ResponseWriter, req *http.Request) { + var err error + requestedFilename := strings.TrimPrefix(req.URL.Path, "/") + println("Requesting file:", requestedFilename) + fileData, err := os.ReadFile(requestedFilename) + if err != nil { + res.WriteHeader(http.StatusBadRequest) + res.Write([]byte(fmt.Sprintf("Could not load file %s", requestedFilename))) + } + + res.Write(fileData) +} + +func main() { + // Create an instance of the app structure + app := NewApp() + + // Create application with options + err := wails.Run(&options.App{ + Title: "helloworld", + Width: 1024, + Height: 768, + Assets: assets, + BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 255}, + OnStartup: app.startup, + AssetsHandler: NewFileLoader(), + Bind: []interface{}{ + app, + }, + }) + + if err != nil { + println("Error:", err) + } +} +``` + +When we run the application in dev mode using `wails dev`, we will see the following output: + +``` +DEB | [ExternalAssetHandler] Loading 'http://localhost:3001/favicon.ico' +DEB | [ExternalAssetHandler] Loading 'http://localhost:3001/favicon.ico' failed, using AssetHandler +Requesting file: favicon.ico +``` +As you can see, the assets handler is called when the default assets server is unable to serve the `favicon.ico` file. + +If you right click the main application and select "inspect" to bring up the devtools, you can test this feature out by typing the following into the console: + +``` +let response = await fetch('does-not-exist.txt'); +``` +This will generate an error in the devtools. We can see that the error is what we expect, returned by our custom assets handler: + +

+ +

+ +However, if we request `go.mod`, we will see the following output: + +

+ +

+ +This technique can be used to load images directly into the page. If we updated our default vanilla template and replaced the logo image: +```html + +``` +with: +```html + +``` +Then we would see the following: + +

+ +

+ +:::warning +Exposing your filesystem in this way is a security risk. It is recommended that you properly manage access +to your filesystem. +::: + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frameless.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frameless.mdx new file mode 100644 index 000000000..5ddd3f6ab --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frameless.mdx @@ -0,0 +1,31 @@ + +# Frameless Applications + +Wails supports applications with no frame. This can be achieved by using the [frameless](../reference/options.mdx#frameless) field in [Application Options](../reference/options.mdx#application-options). + +Wails offers a simple solution for dragging the window: Any HTML element that has the attribute "data-wails-drag" will act as a "drag handle". This property applies to all nested elements. If you need to indicate that a nested element should not drag, then use the attribute 'data-wails-no-drag' on that element. + +The default vanilla template uses this, even though it is not frameless. The whole `body` element is tagged as draggable. The `
` is tagged as being not draggable. + +```html + + + + + + + +
+ + +
+
+ + + + +``` + +:::info Fullscreen + If you allow your application to go fullscreen, this drag functionality will be disabled. +::: diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frontend.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frontend.mdx new file mode 100644 index 000000000..0319301e7 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frontend.mdx @@ -0,0 +1,76 @@ + +# Frontend + +## Script Injection + +When Wails serves your `index.html`, by default, it will inject 2 script entries into the `` tag to load `/wails/ipc.js` and `/wails/runtime.js`. These files install the bindings and runtime respectively. + +The code below shows where these are injected by default: + +```html + + + injection example + + + + + + + +
Please enter your name below 👇
+
+ + +
+ + + + + +``` + +### Overriding Default Script Injection + +To provide more flexibility to developers, there is a meta tag that may be used to customise this behaviour: + +```html + +``` + +The options are as follows: + +| Value | Description | +| ------------------- | ------------------------------------------------ | +| noautoinjectruntime | Disable the autoinjection of `/wails/runtime.js` | +| noautoinjectipc | Disable the autoinjection of `/wails/ipc.js` | +| noautoinject | Disable all autoinjection of scripts | + +Multiple options may be used provided they are comma seperated. + +This code is perfectly valid and operates the same as the autoinjection version: + +```html + + + + injection example + + + + + + +
Please enter your name below 👇
+
+ + +
+ + + + + + + +``` \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/ides.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/ides.mdx new file mode 100644 index 000000000..b2f43d8a5 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/ides.mdx @@ -0,0 +1,111 @@ + +# IDEs + +Wails aims to provide a great development experience. To that aim, we now support generating IDE specific configuration to provide smoother project setup. + +Currently, we support [Visual Studio Code](https://code.visualstudio.com/) but aim to support other IDEs such as Goland. + +## Visual Studio Code + +

+ +

+ +When generating a project using the `-ide vscode` flags, IDE files will be created alongside the other project files. These files are placed into the `.vscode` directory and provide the correct configuration for debugging your application. + +The 2 files generated are `tasks.json` and `launch.json`. Below are the files generated for the default vanilla project: + +```json title="tasks.json" +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "go", + "args": ["build", "-tags", "dev", "-gcflags", "all=-N -l", "-o", "build/bin/myproject.exe"] + }, + ] +} +``` + +```json title="launch.json" +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Wails: Debug myproject", + "type": "go", + "request": "launch", + "mode": "exec", + "program": "${workspaceFolder}/build/bin/myproject.exe", + "preLaunchTask": "build", + "cwd": "${workspaceFolder}", + "env": {} + }, + ] +} +``` + +### Configuring the install and build steps + +The `tasks.json` file is simple for the default project as there is no `npm install` or `npm run build` step needed. For projects that have a frontend build step, such as the svelte template, we would need to edit `tasks.json` to add the install and build steps: + +```json title="tasks.json" +{ + "version": "2.0.0", + "tasks": [ + { + "label": "npm install", + "type": "npm", + "script": "install", + "options": { + "cwd": "${workspaceFolder}/frontend" + }, + "presentation": { + "clear": true, + "panel": "shared", + "showReuseMessage": false + }, + "problemMatcher": [] + }, + { + "label": "npm run build", + "type": "npm", + "script": "build", + "options": { + "cwd": "${workspaceFolder}/frontend" + }, + "presentation": { + "clear": true, + "panel": "shared", + "showReuseMessage": false + }, + "problemMatcher": [] + }, + { + "label": "build", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "go", + "args": ["build", "-tags", "dev", "-gcflags", "all=-N -l", "-o", "build/bin/vscode.exe"], + "dependsOn":[ + "npm install", + "npm run build" + ] + + }, + ] +} +``` + +:::info Future Enhancement + +In the future, we hope to generate a `tasks.json` that includes the install and build steps automatically. + +::: \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/linux-distro-support.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/linux-distro-support.mdx new file mode 100644 index 000000000..a8dcc0bdd --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/linux-distro-support.mdx @@ -0,0 +1,101 @@ + +# Linux Distro Support + +## Overview + +Wails offers Linux support but providing installation instructions for all available distributions is an impossible task. Instead, Wails tries to determine if the packages you need to develop applications are available via your system's package manager. Currently, we support the following package managers: + +- apt +- dnf +- emerge +- eopkg +- nixpkgs +- pacman +- zypper + +## Adding package names + +There may be circumstances where your distro uses one of the supported package managers but the package name is different. For example, you may use an Ubuntu derivative, but the package name for gtk may be different. Wails attempts to find the correct package by iterating through a list of package names. The list of packages are stored in the packagemanager specific file in the `v2/internal/system/packagemanager` directory. In our example, this would be `v2/internal/system/packagemanager/apt.go`. + +In this file, the list of packages are defined by the `Packages()` method: + +```go +func (a *Apt) Packages() packagemap { + return packagemap{ + "libgtk-3": []*Package{ + {Name: "libgtk-3-dev", SystemPackage: true, Library: true}, + }, + "libwebkit": []*Package{ + {Name: "libwebkit2gtk-4.0-dev", SystemPackage: true, Library: true}, + }, + "gcc": []*Package{ + {Name: "build-essential", SystemPackage: true}, + }, + "pkg-config": []*Package{ + {Name: "pkg-config", SystemPackage: true}, + }, + "npm": []*Package{ + {Name: "npm", SystemPackage: true}, + }, + "docker": []*Package{ + {Name: "docker.io", SystemPackage: true, Optional: true}, + }, + } +} +``` + +Let's assume that in our linux distro, `libgtk-3` is packaged under the name `lib-gtk3-dev`. We could add support for this by adding the following line: + +```go {5} +func (a *Apt) Packages() packagemap { + return packagemap{ + "libgtk-3": []*Package{ + {Name: "libgtk-3-dev", SystemPackage: true, Library: true}, + {Name: "lib-gtk3-dev", SystemPackage: true, Library: true}, + }, + "libwebkit": []*Package{ + {Name: "libwebkit2gtk-4.0-dev", SystemPackage: true, Library: true}, + }, + "gcc": []*Package{ + {Name: "build-essential", SystemPackage: true}, + }, + "pkg-config": []*Package{ + {Name: "pkg-config", SystemPackage: true}, + }, + "npm": []*Package{ + {Name: "npm", SystemPackage: true}, + }, + "docker": []*Package{ + {Name: "docker.io", SystemPackage: true, Optional: true}, + }, + } +} +``` + +## Adding new package managers + +To add a new package manager, perform the following steps: + +- Create a new file in `v2/internal/system/packagemanager` called `.go`, where `` is the name of the package manager. +- Define a struct that conforms to the package manager interface defined in `pm.go`: + +```go +type PackageManager interface { + Name() string + Packages() packagemap + PackageInstalled(*Package) (bool, error) + PackageAvailable(*Package) (bool, error) + InstallCommand(*Package) string +} +``` +- `Name()` should return the name of the package manager +- `Packages()` should return a `packagemap`, that provides candidate filenames for dependencies +- `PackageInstalled()` should return `true` if the given package is installed +- `PackageAvailable()` should return `true` if the given package is not installed but available for installation +- `InstallCommand()` should return the exact command to install the given package name + +Take a look at the other package managers code to get an idea how this works. + +:::info Remember +If you add support for a new package manager, don't forget to also update this page! +::: \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/manual-builds.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/manual-builds.mdx new file mode 100644 index 000000000..35431f13f --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/manual-builds.mdx @@ -0,0 +1,96 @@ + +# Manual Builds + +The Wails CLI does a lot of heavy lifting for the project, but sometimes it's desirable to manually build your project. This document will discuss the different operations the CLI does and how this may be achieved in different ways. + +## Build Process + +When either `wails build` or `wails dev` are used, the Wails CLI performs a common build process: + + - Install frontend dependencies + - Build frontend project + - Generate build assets + - Compile application + - [optional] Compress application + +### Install frontend dependencies + +#### CLI Steps + +- If the `-s` flag is given, this step is skipped +- Checks `wails.json` to see if there is an install command in the key `frontend:install` +- If there isn't, it skips this step +- If there is, it checks if `package.json` exists in the frontend directory. If it doesn't exist, it skips this step +- An MD5 sum is generated from the `package.json` file contents +- It checks for the existence of `package.json.md5` and if it exists, will compare the contents of it (an MD5 sum) with the one generated to see if the contents have changed. If they are the same, this step is skipped +- If `package.json.md5` does not exist, it creates it using the generated MD5 sum +- If a build is now required, or `node_modules` does not exist, or the `-f` flag is given, the install command is executed in the frontend directory + +#### Manual Steps + +This step could be done from the command line or a script with `npm install`. + +### Build frontend project + +#### Wails CLI + +- If the `-s` flag is given, this step is skipped +- Checks `wails.json` to see if there is a build command in the key `frontend:build` +- If there isn't, it skips this step +- If there is, it is executed in the frontend directory + +#### Manual Steps + +This step could be done from the command line or a script with `npm run build` or whatever the frontend build script is. + +### Generate assets + +#### Wails CLI + +- If `-nopackage` flag is set, this stage is skipped +- If the `build/appicon.png` file does not exist, a default one is created +- For Windows, see [Bundling for Windows](#windows) +- If `build/windows/icon.ico` does not exist, it will create it from the `build/appicon.png` image. + +##### Windows + +- If `build/windows/icon.ico` does not exist, it will create it from `build/appicon.png` using icon sizes of 256, 128, 64, 48, 32 and 16. This is done using [winicon](https://github.com/leaanthony/winicon). +- If the `build/windows/.manifest` file does not exist, it creates it from a default version. +- Compiles the application as a production build (above) +- Uses [winres](https://github.com/tc-hib/winres) to bundle the icon and manifest into a `.syso` file ready for linking. + +#### Manual Steps + +- Create `icon.ico` using the [winicon](https://github.com/leaanthony/winicon) CLI tool (or any other tool). +- Create / Update a `.manifest` file for your application +- Use the [winres CLI](https://github.com/tc-hib/go-winres) to generate a `.syso` file. + +### Compile application + +#### Wails CLI + +- If the `-clean` flag is provided, the `build` directory is deleted and recreated +- For `wails dev`, the following default Go flags are used: `-tags dev -gcflags "all=-N -l"` +- For `wails build`, the following default Go flags are used: `-tags desktop,production -ldflags "-w -s"` + - On Windows, `-ldflags "-w -h -H windowsgui"` +- Additional tags passed to the CLI using `-tags` are added to the defaults +- Additional ldflags passed to the CLI using `-ldflags` are added to the defaults +- The `-o` flag is passed through +- The Go compiler specified by `-compiler` will be used for compilation + +#### Manual steps + +- For dev build, the minimum command would be: `go build -tags dev -gcflags "all=-N -l"` +- For production build, the minimum command would be: `go build -tags desktop,production -ldflags "-w -s -H windowsgui"` +- Ensure that you compile in the same directory as the `.syso` file + +### Compress application + +#### Wails CLI + +- If the `-upx` flag has been given, the `upx` program will be run to compress the application with the default settings +- If `-upxflags` is also passed, these flags are used instead of the default ones + +#### Manual steps + +- Run `upx [flags]` manually to compress the application. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/migrating.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/migrating.mdx new file mode 100644 index 000000000..b5142f507 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/migrating.mdx @@ -0,0 +1,189 @@ + +# Migrating from v1 + +## Overview + +Wails v2 is a significant change from v1. This document aims to highlight the changes and the steps in migrating an existing project. + +### Creating the Application + +In v1, the main application is created using `wails.CreateApp`, bindings are added with `app.Bind`, then the application is run using `app.Run()`. + +Example: + +```go title="v1" + app := wails.CreateApp(&wails.AppConfig{ + Title: "MyApp", + Width: 1024, + Height: 768, + JS: js, + CSS: css, + Colour: "#131313", + }) + app.Bind(basic) + app.Run() +``` + +In v2, there is just a single method, `wails.Run()`, that accepts [application options](../reference/options.mdx#application-options). + +```go title="v2" + err := wails.Run(&options.App{ + Title: "MyApp", + Width: 800, + Height: 600, + Assets: assets, + Bind: []interface{}{ + basic, + }, + }) +``` + +### Binding + +In v1, it was possible to bind both arbitrary functions and structs. In v2, this has been simplified to only binding structs. The struct instances that were previously passed to the `Bind()` method in v1, are now specified in the `Bind` field of the [application options](../reference/options.mdx#application-options): + +```go title="v1" + app := wails.CreateApp(/* options */) + app.Bind(basic) +``` + +```go title="v2" + err := wails.Run(&options.App{ + /* other options */ + Bind: []interface{}{ + basic, + }, + }) +``` + +In v1, bound methods were available to the frontend at `window.backend`. This has changed to `window.go`.`` + +### Application Lifecycle + +In v1, there were 2 special methods in a bound struct: `WailsInit()` and `WailsShutdown()`. These have been replaced with 3 lifecycle hooks as part of the [application options](../reference/options.mdx#application-options): + +- [OnStartup](../reference/options.mdx#onstartup) +- [OnShutdown](../reference/options.mdx#onshutdown) +- [OnDomReady](../reference/options.mdx#ondomready) + +Note: [OnDomReady](../reference/options.mdx#ondomready) replaces the `wails:ready` system event in v1. + +These methods can be standard functions, but a common practice is to have them part of a struct: + +```go title="v2" + basic := NewBasicApp() + err := wails.Run(&options.App{ + /* Other Options */ + OnStartup: basic.startup, + OnShutdown: basic.shutdown, + OnDomReady: basic.domready, + }) +... +type Basic struct { + ctx context.Context +} +func (b *Basic) startup(ctx context.Context) { + b.ctx = ctx +} +... +``` + +### Runtime + +The runtime in v2 is much richer than v1 with support for menus, window manipulation and better dialogs. The signature of the methods has changed slightly - please refer the the [Runtime Reference](../reference/runtime/intro.mdx). + +In v1, the [runtime](../reference/runtime/intro.mdx) was available via a struct passed to `WailsInit()`. In v2, the runtime has been moved out to its own package. Each method in the runtime takes the `context.Context` that is passed to the [OnStartup](../reference/options.mdx#onstartup) method. + +```go title="Runtime Example" +package main + +import "github.com/wailsapp/wails/v2/pkg/runtime" + +type Basic struct { + ctx context.Context +} + +// startup is called at application startup +func (a *App) startup(ctx context.Context) { + a.ctx = ctx + runtime.LogInfo(ctx, "Application Startup called!") +} + +``` + +### Assets + +The _biggest_ change in v2 is how assets are handled. + +In v1, assets were passed via 2 application options: + +- `JS` - The application's Javascript +- `CSS` - The application's CSS + +This meant that the responsibility of generating a single JS and CSS file was on the developer. This essentially required the use of complicated packers such as webpack. + +In v2, Wails makes no assumptions about your frontend assets, just like a webserver. All of your application assets are passed to the application options as an `embed.FS`. + +**This means there is no requirement to bundle your assets, encode images as Base64 or attempt the dark art of bundler configuration to use custom fonts**. + +At startup, Wails will scan the given `embed.FS` for `index.html` and use its location as the root path for all the other application assets - just like a webserver would. + +Example: An application has the following project layout. All final assets are placed in the `frontend/dist` directory: + +```shell +. +├── build/ +├── frontend/ +│ └── dist/ +│ ├── index.html +│ ├── main.js +│ ├── main.css +│ └── logo.svg +├── main.go +└── wails.json +``` + +Those assets may be used by the application by simply creating an `embed.FS`: + +```go title="Assets Example" +//go:embed frontend/dist +var assets embed.FS + +func main() { + err := wails.Run(&options.App{ + /* Other Options */ + Assets: assets, + }) +} +``` + +Of course, bundlers can be used if you wish to. The only requirement is to pass the final application assets directory to Wails using an `embed.FS` in the `Assets` key of the [application options](../reference/options.mdx#application-options). + +### Project Configuration + +In v1, the project configuration was stored in the `project.json` file in the project root. In v2, the project configuration is stored in the `wails.json` file in the project root. + +The format of the file is slightly different. Here is a comparison: + +

+ +| v1 | v2 | Notes | +| ------------------ | ---------------- | --------------------------------------------------- | +| name | name | | +| description | | Removed | +| author / name | author / name | | +| author / email | author / email | | +| version | version | | +| binaryname | outputfilename | Changed | +| frontend / dir | | Removed | +| frontend / install | frontend:install | Changed | +| frontend / build | frontend:build | Changed | +| frontend / bridge | | Removed | +| frontend / serve | | Removed | +| tags | | Removed | +| | wailsjsdir | The directory to generate wailsjs modules | +| | assetdir | The directory of the compiled frontend assets for `dev` mode. This is normally inferred and could be left empty. | +| | reloaddirs | Comma separated list of additional directories to watch for changes and to trigger reloads in `dev` mode. This is only needed for some more advanced asset configurations. | + +

+ diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/mouse-buttons.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/mouse-buttons.mdx new file mode 100644 index 000000000..70a8b3828 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/mouse-buttons.mdx @@ -0,0 +1,26 @@ +# Mouse Buttons + +The Wails runtime intercepts mouse clicks to determine whether a frameless window needs resizing or a window needs to be moved. It has been asked how to detect when a mouse click has occurred, because `window.onclick` doesn't report the mouse buttons correctly. The following code shows how to detect mouse clicks: + +```javascript + +window.addEventListener('mousedown', handleMouseButtonDown); + +function handleMouseButtonDown(event) { + if (event.button === 0) { + // left mouse button + } else if (event.button === 1) { + // middle mouse button + } else if (event.button === 2) { + // right mouse button + } else if (event.button === 3) { + // back mouse button + } else if (event.button === 4) { + // forward mouse button + } else { + // other mouse button + } +} + +``` +Reference: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/overscroll.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/overscroll.mdx new file mode 100644 index 000000000..e20c9a20f --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/overscroll.mdx @@ -0,0 +1,10 @@ + +# Overscroll + +[Overscroll](https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior) is the "bounce effect" you sometimes get when you scroll beyond a page's content boundaries. This is common in mobile apps. This can be disabled using CSS: + +```css +body { + overscroll-behavior: none; +} +``` \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/routing.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/routing.mdx new file mode 100644 index 000000000..3e1f255d8 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/routing.mdx @@ -0,0 +1,27 @@ + +# Routing + +Routing is a popular way to switch views in an application. This page offers some guidance around how to do that. + +## Vue + +The recommended approach for routing in Vue is [Hash Mode](https://next.router.vuejs.org/guide/essentials/history-mode.html#hash-mode): + +```js +import { createRouter, createWebHashHistory } from 'vue-router' + +const router = createRouter({ + history: createWebHashHistory(), + routes: [ + //... + ], +}) +``` + +## Angular + +The recommended approach for routing in Angular is [HashLocationStrategy](https://codecraft.tv/courses/angular/routing/routing-strategies#_hashlocationstrategy): + +```ts +RouterModule.forRoot(routes, {useHash: true}) +``` \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/signing.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/signing.mdx new file mode 100644 index 000000000..6e16f5c5c --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/signing.mdx @@ -0,0 +1,362 @@ +# Code Signing + +This is a guide on how you can sign your binaries generated with Wails on MacOS and Windows. The guide will target CI environments, more specifically GitHub Actions. + +## Windows +First off you need a code signing certificate. If you do not already have one, Microsoft's info page lists some providers [here](https://docs.microsoft.com/en-us/windows-hardware/drivers/dashboard/get-a-code-signing-certificate). Please note that an EV certificate is not required unless you need to write kernel-level software such as device drivers. For signing your Wails app, a standard code signing certificate will do just fine. + +It may be a good idea to check with your certificate provider how to sign your binaries on your local machine before targeting automated build systems, just so you know if there are any special requirements. For instance, [here](https://www.ssl.com/how-to/using-your-code-signing-certificate/) is SSL.com's code signing guide for Windows. If you know how to sign locally, it will be easier to troubleshoot any potential issues in a CI environment. For instance, SSL.com code signing certificates require the `/tr` flag for [SignTool.exe](https://docs.microsoft.com/en-us/windows/win32/seccrypto/signtool) while other providers may only need the `/t` flag for providing the timestamping server. Popular GitHub Actions for signing Windows binaries like [this one](https://github.com/Dana-Prajea/code-sign-action) does not support the `/tr` flag on SignTool.exe. Therefore this guide will focus on signing our app manually with PowerShell commands, but you can use actions like the [code-sign-action](https://github.com/Dana-Prajea/code-sign-action) Action if you prefer. + +First off, let's make sure we are able to build our Wails app in our GitHub CI. Here is a small workflow template: +```yaml +name: "example" +on: + workflow_dispatch: + # This Action only starts when you go to Actions and manually run the workflow. + +jobs: + package: + strategy: + matrix: + platform: [ windows-latest, macos-latest ] + go-version: [1.18] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: setup node + uses: actions/setup-node@v2 + with: + node-version: 14 + # You may need to manually build you frontend manually here, unless you have configured frontend build and install commands in wails.json. + - name: Get Wails + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest + - name: Build Wails app + run: | + wails build + - name: upload artifacts macOS + if: matrix.platform == 'macos-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-macos + path: build/bin/* + - name: upload artifacts windows + if: matrix.platform == 'windows-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-windows + path: build/bin/* +``` + +Next we need to give the GitHub workflow access to our signing certificate. This is done by encoding your .pfx or .p12 certificate into a base64 string. To do this in PowerShell, you can use the following command assuming your certificate is called 'my-cert.p12': +```PowerShell +certutil -encode .\my-cert.p12 my-cert-base64.txt +``` + +You should now have your .txt file with the base64 encoded certificate. It should start with *-----BEGIN CERTIFICATE-----* and end with *-----END CERTIFICATE-----*. Now you need to make two action secrets on GitHub. Navigate to *Settings -> Secrets -> Actions* and create the two following secrets: +* **WIN_SIGNING_CERT** with the contents of your base64 encoded certificate text. +* **WIN_SIGNING_CERT_PASSWORD** with the contents of your certificate password. + +Now we're ready to implement the signing in our workflow using one of the two methods: + +### Method 1: signing with commands +This method uses PowerShell commands to sign our app, and leaves you control over the entire signing process. + +After the `"Build Wails app"` step, we can add the following step to our workflow: +```yaml +- name: Sign Windows binaries + if: matrix.platform == 'windows-latest' + run: | + echo "Creating certificate file" + New-Item -ItemType directory -Path certificate + Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}' + certutil -decode certificate\certificate.txt certificate\certificate.pfx + echo "Signing our binaries" + & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd /t /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' + +``` +This script creates a new directory for your certificate file, creates the certificate file from our base64 secret, converts it to a .pfx file, and finally signs the binary. The following variables needs to be replaced in the last line: +* **signing algorithm**: usually sha256. +* **timestamping server**: URL to the timestamping server to use with your certificate. +* **path to binary**: path to the binary you want to sign. + +Given that our Wails config has `outputfilename` set to "app.exe" and that we have a certificate from SSL.com, this would be our workflow: +```yaml +name: "example" +on: + workflow_dispatch: + # This Action only starts when you go to Actions and manually run the workflow. + +jobs: + package: + strategy: + matrix: + platform: [ windows-latest, macos-latest ] + go-version: [1.18] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: setup node + uses: actions/setup-node@v2 + with: + node-version: 14 + # You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json. + - name: Get Wails + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest + - name: Build Wails app + run: | + wails build + - name: Sign Windows binaries + if: matrix.platform == 'windows-latest' + run: | + echo "Creating certificate file" + New-Item -ItemType directory -Path certificate + Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}' + certutil -decode certificate\certificate.txt certificate\certificate.pfx + echo "Signing our binaries" + & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' .\build\bin\app.exe + + - name: upload artifacts macOS + if: matrix.platform == 'macos-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-macos + path: build/bin/* + - name: upload artifacts windows + if: matrix.platform == 'windows-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-windows + path: build/bin/* +``` + +### Method 2: automatically signing with Action +It is possible to use a Windows code signing Action like [this](https://github.com/marketplace/actions/code-sign-a-file-with-pfx-certificate) one, but note it requires a SHA1 hash for the certificate and a certificate name. View an example of how to configure it on the Action's [marketplace](https://github.com/marketplace/actions/code-sign-a-file-with-pfx-certificate). + +--- + +## MacOS + +First off you need your code signing certificate from Apple. If you do not have one, a simple Google search will help you acquire one. Once you have your certificate, you need to export it and encode it to base64. [This tutorial](https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions) shows you how to do that in an easy manner. Once you have exported your .p12 certificate file, you can encode it to base64 as seen in the tutorial with the following command: +```bash +base64 Certificates.p12 | pbcopy +``` + +Now you're ready to create some GitHub project secrets, just as with Windows: +* **APPLE_DEVELOPER_CERTIFICATE_P12_BASE64** with the contents of your newly copied base64 certificate. +* **APPLE_DEVELOPER_CERTIFICATE_PASSWORD** with the contents of your certificate password. +* **APPLE_PASSWORD** with the contents of an App-Specific password to your Apple-ID account which you can generate [here](https://appleid.apple.com/account/manage). + +Let's make sure we are able to build our Wails app in our GitHub Action workflow. Here is a small template: + +```yaml +name: "example" +on: + workflow_dispatch: + # This Action only starts when you go to Actions and manually run the workflow. + +jobs: + package: + strategy: + matrix: + platform: [ windows-latest, macos-latest ] + go-version: [1.18] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: setup node + uses: actions/setup-node@v2 + with: + node-version: 14 + # You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json. + - name: Get Wails + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest + - name: Build Wails app + run: | + wails build + - name: upload artifacts macOS + if: matrix.platform == 'macos-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-macos + path: build/bin/* + - name: upload artifacts windows + if: matrix.platform == 'windows-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-windows + path: build/bin/* +``` + +For code signing on macOS, [gon](https://github.com/mitchellh/gon) is a very handy tool for code signing and communicating with Apple servers, also written in Go, and will be used in this guide. + +After the `Build Wails app` step, add the following to the workflow: +```yaml +- name: MacOS download gon for code signing and app notarization + if: matrix.platform == 'macos-latest' + run: | + brew install mitchellh/gon/gon +``` + +Now we need to configure some gon config files in our `build/darwin` directory: + +1. gon-sign.json: + ```json + { + "source" : ["./build/bin/app.app"], + "bundle_id" : "app.myapp", + "apple_id": { + "username": "my-appleid@email.com", + "password": "@env:APPLE_PASSWORD" + }, + "sign" :{ + "application_identity" : "Developer ID Application: My Name" + } + } + ``` + Where `source` is your Wails binary, `bundle_id` is your bundle ID, `apple_id` contains your Apple ID username and App-Specific password which you created earlier, and `sign.application_identity` is your identity which you can find by running the following command: + ```bash + security find-identity -v -p codesigning + ``` +2. entitlements.plist: + ```plist + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.files.user-selected.read-write + + com.apple.security.files.downloads.read-write + + + + ``` + In this file you configure the entitlements you need for you app, e.g. camera permissions if your app uses the camera. Read more about entitlements [here](https://developer.apple.com/documentation/bundleresources/entitlements). + +Make sure you have updated your `Info.plist` file with the same bundle ID as you entered in `gon-sign.json`. Here's an example `Info.plist` file: +```plist + + + CFBundlePackageTypeAPPL + CFBundleNameMyApp + CFBundleExecutableapp + CFBundleIdentifierapp.myapp + CFBundleVersion0.1.0 + CFBundleGetInfoStringMy app is cool and nice and chill and + CFBundleShortVersionString0.1.0 + CFBundleIconFileiconfile + LSMinimumSystemVersion10.13.0 + NSHighResolutionCapabletrue + LSApplicationCategoryTypepublic.app-category.utilities + NSHumanReadableCopyright© Me + +``` + +Now we're ready to add the signing step in our workflow after building the Wails app: +```yaml +- name: Import Code-Signing Certificates for macOS + if: matrix.platform == 'macos-latest' + uses: Apple-Actions/import-codesign-certs@v1 + with: + # The certificates in a PKCS12 file encoded as a base64 string + p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} + # The password used to import the PKCS12 file. + p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} +- name: Sign our macOS binary + if: matrix.platform == 'macos-latest' + run: | + echo "Signing Package" + gon -log-level=info ./build/darwin/gon-sign.json +``` +Please note that signing binaries with Apple could take anywhere from minutes to hours. + +## Combined workflow file: +Here is our GitHub workflow file with Windows + macOS combined: +```yaml +name: "example combined" +on: + workflow_dispatch: + # This Action only starts when you go to Actions and manually run the workflow. + +jobs: + package: + strategy: + matrix: + platform: [ windows-latest, macos-latest ] + go-version: [1.18] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: setup node + uses: actions/setup-node@v2 + with: + node-version: 14 + # You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json. + - name: Get Wails + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest + - name: Build Wails app + run: | + wails build + - name: MacOS download gon for code signing and app notarization + if: matrix.platform == 'macos-latest' + run: | + brew install mitchellh/gon/gon + - name: Import Code-Signing Certificates for macOS + if: matrix.platform == 'macos-latest' + uses: Apple-Actions/import-codesign-certs@v1 + with: + # The certificates in a PKCS12 file encoded as a base64 string + p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} + # The password used to import the PKCS12 file. + p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} + - name: Sign our macOS binary + if: matrix.platform == 'macos-latest' + run: | + echo "Signing Package" + gon -log-level=info ./build/darwin/gon-sign.json + - name: Sign Windows binaries + if: matrix.platform == 'windows-latest' + run: | + echo "Creating certificate file" + New-Item -ItemType directory -Path certificate + Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}' + certutil -decode certificate\certificate.txt certificate\certificate.pfx + echo "Signing our binaries" + & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' .\build\bin\Monitor.exe + - name: upload artifacts macOS + if: matrix.platform == 'macos-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-macos + path: build/bin/* + - name: upload artifacts windows + if: matrix.platform == 'windows-latest' + uses: actions/upload-artifact@v2 + with: + name: wails-binaries-windows + path: build/bin/* +``` + +# End notes +This guide inspired by the RiftShare project and its workflow, which is highly recommended to check out [here](https://github.com/achhabra2/riftshare/blob/main/.github/workflows/build.yaml). \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/templates.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/templates.mdx new file mode 100644 index 000000000..517e03f71 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/templates.mdx @@ -0,0 +1,93 @@ + +# Templates + +Wails generates projects from pre-created templates. In v1, this was a difficult to maintain set of projects that were subject to going out of date. In v2, to empower the community, a couple of new features have been added for templates: + +- Ability to generate projects from [Remote Templates](../reference/cli.mdx#remote-templates) +- Tooling to help create your own templates + +## Creating Templates + +To create a template, you can use the `wails generate template` command. To generate a default template, run: + +`wails generate template -name mytemplate` + +This creates the directory "mytemplate" with default files: + +```shell title=mytemplate/ +. +|-- NEXTSTEPS.md +|-- README.md +|-- app.tmpl.go +|-- frontend +| `-- dist +| |-- assets +| | |-- fonts +| | | |-- OFL.txt +| | | `-- nunito-v16-latin-regular.woff2 +| | `-- images +| | `-- logo-dark.svg +| |-- index.html +| |-- main.css +| `-- main.js +|-- go.mod.tmpl +|-- main.tmpl.go +|-- template.json +`-- wails.tmpl.json +``` + +### Template Overview + +The default template consists of the following files and directories: + +| Filename / Dir | Description | +| --------------- | -------------------------------------------- | +| NEXTSTEPS.md | Instructions on how to complete the template | +| README.md | The README published with the template | +| app.tmpl.go | `app.go` template file | +| frontend/ | The directory containing frontend assets | +| go.mod.tmpl | `go.mod` template file | +| main.tmpl.go | `main.go` template file | +| template.json | The template metadata | +| wails.tmpl.json | `wails.json` template file | + +At this point it is advisable to follow the steps in `NEXTSTEPS.md`. + +## Creating a Template from an Existing Project + +It's possible to create a template from an existing frontend project by passing the path to the project when generating the template. We will now walk through how to create a Vue 3 template: + +- Install the vue cli: `npm install -g @vue/cli` +- Create the default project: `vue create vue3-base` + - Select `Default (Vue 3) ([Vue 3] babel, eslint)` +- After the project has been generated, run: + +```shell +> wails generate template -name wails-vue3-template -frontend .\vue3-base\ +Extracting base template files... +Migrating existing project files to frontend directory... +Updating package.json data... +Renaming package.json -> package.tmpl.json... +Updating package-lock.json data... +Renaming package-lock.json -> package-lock.tmpl.json... +``` + +- The template may now be customised as specified in the `NEXTSTEPS.md` file +- Once the files are ready, it can be tested by running: `wails init -n my-vue3-project -t .\wails-vue3-template\` +- To test the new project, run: `cd my-vue3-project` then `wails build` +- Once the project has compiled, run it: `.\build\bin\my-vue3-project.exe` +- You should have a fully functioning Vue3 application: + +
+ +
+ +## Publishing Templates + +Publishing a template is simply pushing the files to GitHub. The following best practice is encouraged: + +- Remove any unwanted files and directories (such as `.git`) from your frontend directory +- Ensure that `template.json` is complete, especially `helpurl` +- Push the files to GitHub +- Create a PR on the [Community Templates](../community/templates.mdx) page +- Announce the template on the [Template Announcement](https://github.com/wailsapp/wails/discussions/825) discussion board diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx new file mode 100644 index 000000000..395496311 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx @@ -0,0 +1,101 @@ +# Troubleshooting + +An assortment of troubleshooting tips. + +## The `wails` command appears to be missing? + +If your system is reporting that the `wails` command is missing, make sure you have followed the Go installation guide correctly. Normally, it means that the `go/bin` directory in your User's home directory is not in the `PATH` environment variable. You will also normally need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected at the command prompt. + +## My application is displaying a white/blank screen + +Check that your application includes the assets from the correct directory. In your `main.go` file, you will have something similar to the following code: + +```go +//go:embed frontend/dist +var assets embed.FS +``` +Check that `frontend/dist` contains your application assets. + +### Mac + +If this happens on Mac, try adding the following to your `Info.plist`: + +```xml +NSAppTransportSecurity + + NSAllowsLocalNetworking + + +``` + +Reference: https://github.com/wailsapp/wails/issues/1504#issuecomment-1174317433 + +## Mac application not valid + +If your built application looks like this in finder: + +

+ +

+ +it''s likely that your application''s `info.plist` is invalid. Update the file in `build/.app/Contents/info.plist` and check if the data is valid, EG check the binary name is correct. To persist the changes, copy the file back to the `build/darwin` directory. + +## Cannot call backend method from frontend with variadic arguments + +If you have a backend method defined with variadic parameters, eg: +```go +func (a *App) TestFunc(msg string, args ...interface{}) error { + // Code +} +``` +calling this method from the frontend like this will fail: +```js +var msg = "Hello: " +var args = ["Go", "JS"] +window.go.main.App.TestFunc(msg, ...args).then((result) => { + //do things here +}).catch((error) => { + //handle error +}); +``` +Workaround: +```js +var msg = "Hello " +var args = ["Go", "JS"] +window.go.main.App.TestFunc(msg, args).then((result) => { //without the 3 dots + //do things here +}).catch((error) => { + //handle error +}); +``` +Credit: https://github.com/wailsapp/wails/issues/1186 + +## I''m having getting proxy errors when trying to install Wails + +If you are getting errors like this: +``` +"https://proxy.golang.org/github.com/wailsapp/wails/cmd/wails/@v/list": dial tcp 172.217.163.49:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. +``` +it's probably because the official Go Proxy is being blocked (Users in China have reported this). The solution is to set up the proxy manually, eg: +``` +go env -w GO111MODULE=on +go env -w GOPROXY=https://goproxy.cn,direct +``` +Source: https://github.com/wailsapp/wails/issues/1233 + +## The generated Typescript doesn''t have the correct types + +Sometimes the generated Typescript doesn''t have the correct types. To mitigate this, it is possible to specify what types should be generated using the `ts_type` struct tag. For more details, please read [this](https://github.com/tkrajina/typescriptify-golang-structs#custom-types). + +## When I navigate away from `index.html`, I am unable to call methods on the frontend + +If you navigate away from `index.html` to a new html file, the context will be lost. This can be fixed by adding the following imports to the `` section of any new page you navigate to: + +```html + + + + +``` + +Source: https://github.com/wailsapp/wails/discussions/1512 \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/windows-installer.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/windows-installer.mdx new file mode 100644 index 000000000..ffd20c04f --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/windows-installer.mdx @@ -0,0 +1,49 @@ +# NSIS installer + +

+
+

+ +Wails supports generating Windows installers using the [NSIS installer](https://nsis.sourceforge.io/). + +## Installing NSIS + +### Windows + +The installer is available on the [NSIS Download](https://nsis.sourceforge.io/Download) page. + +If you use the chocolatey package manager, run the following script: +``` +choco install nsis +``` +If you install NSIS manually, you need to add the *Bin* folder, which contains `makensis.exe`, in your NSIS installation to your path. [Here](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/) is a good tutorial on how to add to path on Windows. + +### Linux + +The `nsis` package should be available through your distribution's package manager. + +### MacOS + +NSIS is available to install through homebrew: `brew install nsis`. + +## Generating the installer + +When a new project is created, Wails generates the NSIS configuration files in `build/windows/installer`. The config data is read from `installer/info.json` and that is configured to use the project's `wails.json` Info section: + +```json +// ... + "Info": { + "companyName": "My Company Name", + "productName": "Wails Vite", + "productVersion": "1.0.0", + "copyright": "Copyright.........", + "comments": "Built using Wails (https://wails.io)" + }, +``` + +To generate an installer for your application, use the `-nsis` flag with `wails build`: +``` +wails build -nsis +``` + +The installer will now be available in the `build/bin` directory. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/windows.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/windows.mdx new file mode 100644 index 000000000..d0e24af3c --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/windows.mdx @@ -0,0 +1,47 @@ + +# Windows + +This page has miscellaneous guides related to developing Wails applications for Windows. + +## Handling the WebView2 Runtime Dependency + +Wails applications built for Windows have a runtime requirement on the Microsoft [WebView2 Runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/). Windows 11 will have this installed by default, but some machines won't. Wails offers an easy approach to dealing with this dependency. + +By using the `-webview2` flag when building, you can decide what your application will do when a suitable runtime is not detected (including if the installed runtime is too old). The four options are: + +1. Download +2. Embed +3. Browser +4. Error + +### Download + +This option will prompt the user that no suitable runtime has been found and then offer to download and run the official bootstrapper from Microsoft's WebView2 site. If the user proceeds, the official bootstrapper will be downloaded and run. + +### Embed + +This option embeds the official bootstrapper within the application. If no suitable runtime has been found, the application will offer to run the bootstrapper. This adds ~150k to the binary size. + +### Browser + +This option will prompt the user that no suitable runtime has been found and then offer to open a browser to the official WebView2 page where the bootstrapper can be downloaded and installed. The application will then exit, leaving the installation up to the user. + +### Error + +If no suitable runtime is found, an error is given to the user and no further action taken. + +## Fixed version runtime + +Another way of dealing with webview2 dependency is shipping it yourself. You can download [fixed version runtime](https://developer.microsoft.com/ru-ru/microsoft-edge/webview2/#download-section) and bundle or download it with your application. + +Also, you should specify path to fixed version of webview2 runtime in the `windows.Options` structure when launching wails. + +```go + wails.Run(&options.App{ + Windows: &windows.Options{ + WebviewBrowserPath: "", + }, + }) +``` + +Note: When `WebviewBrowserPath` is specified, `error` strategy will be forced in case of minimal required version mismatch or invalid path to a runtime. \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/howdoesitwork.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/howdoesitwork.mdx new file mode 100644 index 000000000..80eb4751a --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/howdoesitwork.mdx @@ -0,0 +1,353 @@ +--- +sidebar_position: 20 +--- + +# How does it work? + +A Wails application is a standard Go application, with a webkit frontend. The Go part of the application consists of the application code and a runtime library that provides a number of useful operations, like controlling the application window. The frontend is a webkit window that will display the frontend assets. Also available to the frontend is a Javascript version of the runtime library. Finally, it is possible to bind Go methods to the frontend, and these will appear as Javascript methods that can be called, just as if they were local Javascript methods. + +
+ +
+ +## The Main Application + +### Overview + +The main application consists of a single call to `wails.Run()`. It accepts the application configuration which describes the size of the application window, the window title, what assets to use, etc. A basic application might look like this: + +```go title="main.go" +package main + +import ( + "embed" + "log" + + "github.com/wailsapp/wails/v2" + "github.com/wailsapp/wails/v2/pkg/options" +) + +//go:embed frontend/dist +var assets embed.FS + +func main() { + + app := &App{} + + err := wails.Run(&options.App{ + Title: "Basic Demo", + Width: 1024, + Height: 768, + Assets: &assets, + OnStartup: app.startup, + OnShutdown: app.shutdown, + Bind: []interface{}{ + app, + }, + }) + if err != nil { + log.Fatal(err) + } +} + + +type App struct { + ctx context.Context +} + +func (b *App) startup(ctx context.Context) { + b.ctx = ctx +} + +func (b *App) shutdown(ctx context.Context) {} + +func (b *App) Greet(name string) string { + return fmt.Sprintf("Hello %s!", name) +} +``` + +### Options rundown + +This example has the following options set: + +- `Title` - The text that should appear in the window's title bar +- `Width` & `Height` - The dimensions of the window +- `Assets` - The application's frontend assets +- `OnStartup` - A callback for when the window is created and is about to start loading the frontend assets +- `OnShutdown` - A callback for when the application is about to quit +- `Bind` - A slice of struct instances that we wish to expose to the frontend + +A full list of application options can be found in the [Options Reference](reference/options). + +#### Assets + +The `Assets` option is mandatory as you can't have a Wails application without frontend assets. Those assets can be any files you would expect to find in a web application - html, js, css, svg, png, etc. **There is no requirement to generate asset bundles** - plain files will do. When the application starts, it will attempt to load `index.html` from your assets and the frontend will essentially work as a browser from that point on. It is worth noting that there is no requirement on where in the `embed.FS` the files live. It is likely that the embed path uses a nested directory relative to your main application code, such as `frontend/dist`: + +```go title="main.go" +//go:embed frontend/dist +var assets embed.FS +``` + +At startup, Wails will iterate the embedded files looking for the directory containing `index.html`. All other assets will be loaded relative to this directory. + +As production binaries use the files contained in `embed.FS`, there are no external files required to be shipped with the application. + +When running in development mode using the `wails dev` command, the assets are loaded off disk, and any changes result in a "live reload". The location of the assets will be inferred from the `embed.FS`. + +More details can be found in the [Application Development Guide](guides/application-development.mdx). + +#### Application Lifecycle Callbacks + +Just before the frontend is about to load `index.html`, a callback is made to the function provided in [OnStartup](reference/options.mdx#onstartup). A standard Go context is passed to this method. This context is required when calling the runtime so a standard pattern is to save a reference to in this method. Just before the application shuts down, the [OnShutdown](reference/options.mdx#onshutdown) callback is called in the same way, again with the context. There is also an [OnDomReady](reference/options.mdx#ondomready) callback for when the frontend has completed loading all assets in `index.html` and is equivalent of the [`body onload`](https://www.w3schools.com/jsref/event_onload.asp) event in Javascript. It is also possible to hook into the window close (or application quit) event by setting the option [OnBeforeClose](reference/options.mdx#onbeforeclose). + +#### Method Binding + +The `Bind` option is one of the most important options in a Wails application. It specifies which struct methods to expose to the frontend. Think of structs like "controllers" in a traditional web application. When the application starts, it examines the struct instances listed in the `Bind` field in the options, determines which methods are public (starts with an uppercase letter) and will generate Javascript versions of those methods that can be called by the frontend code. + +:::info Note + + Wails requires that you pass in an *instance* of the struct for it to bind it correctly + +::: + +In this example, we create a new `App` instance and then add this instance to the `Bind` option in `wails.Run`: + +```go {16,24} title="main.go" +package main + +import ( + "embed" + "log" + + "github.com/wailsapp/wails/v2" + "github.com/wailsapp/wails/v2/pkg/options" +) + +//go:embed frontend/dist +var assets embed.FS + +func main() { + + app := &App{} + + err := wails.Run(&options.App{ + Title: "Basic Demo", + Width: 1024, + Height: 768, + Assets: &assets, + Bind: []interface{}{ + app, + }, + }) + if err != nil { + log.Fatal(err) + } +} + + +type App struct { + ctx context.Context +} + +func (a *App) Greet(name string) string { + return fmt.Sprintf("Hello %s!", name) +} +``` + +You may bind as many structs as you like. Just make sure you create an instance of it and pass it in `Bind`: + +```go {8-10} + //... + err := wails.Run(&options.App{ + Title: "Basic Demo", + Width: 1024, + Height: 768, + Assets: &assets, + Bind: []interface{}{ + app, + &mystruct1{}, + &mystruct2{}, + }, + }) + +``` + +When you run `wails dev` (or `wails generate module`), a frontend module will be generated containing the following: + - Javascript bindings for all bound methods + - Typescript declarations for all bound methods + - Typescript definitions for all Go structs used as inputs or outputs by the bound methods + +This makes it incredibly simple to call Go code from the frontend, using the same strongly typed datastructures. + +## The Frontend + +### Overview + +The frontend is a collection of files rendered by webkit. It's like a browser and webserver in one. There is virtually[^1] no limit to which frameworks or libraries you can use. The main points of interaction between the frontend and your Go code are: + +- Calling bound Go methods +- Calling runtime methods + +### Calling bound Go methods + +When you run your application with `wails dev`, it will automatically generate Javascript bindings for your structs in a directory called `wailsjs/go` (You can also do this by running `wails generate module`). The generated files mirror the package names in your application. In the example above, we bind `app`, which has one public method `Greet`. This will lead to the generation of the following files: + +```bash +wailsjs + └─go + └─main + ├─App.d.ts + └─App.js +``` +Here we can see that there is a `main` package that contains the Javascript bindings for the bound `App` struct, as well as the Typescript declaration file for those methods. To call `Greet` from our frontend, we simply import the method and call it like a regular Javascript function: + +```javascript + // ... + import {Greet} from '../wailsjs/go/main/App' + + function doGreeting(name) { + Greet(name).then((result) => { + // Do something with result + }) + } +``` +The Typescript declaration file gives you the correct types for the bound methods: + +```ts +export function Greet(arg1:string):Promise; +``` + +The generated methods return a Promise. A successful call will result in the first return value from the Go call to be passed to the `resolve` handler. An unsuccessful call is when a Go method that has an error type as it's second return value, passes an error instance back to the caller. This is passed back via the `reject` handler. In the example above, `Greet` only returns a `string` so the Javascript call will never reject - unless invalid data is passed to it. + +All data types are correctly translated between Go and Javascript. Even structs. If you return a struct from a Go call, it will be returned to your frontend as a Javascript class. Note: If you wish to use structs, you **must** define `json` struct tags for your fields! + +:::info Note +Anonymous nested structs are not supported at this time. +::: + +It is possible to send structs back to Go. Any Javascript map/class passed as an argument that is expecting a struct, will be converted to that struct type. To make this process a lot easier, in `dev` mode, a TypeScript module is generated, defining all the struct types used in bound methods. Using this module, it's possible to construct and send native Javascript objects to the Go code. + +There is also support for Go methods that use structs in their signature. All Go structs specified by a bound method (either as parameters or return types) will have Typescript versions auto generated as part of the Go code wrapper module. Using these, it's possible to share the same data model between Go and Javascript. + +Example: We update our `Greet` method to accept a `Person` instead of a string: + +```go title="main.go" +type Person struct { + Name string `json:"name"` + Age uint8 `json:"age"` + Address *Address `json:"address"` +} + +type Address struct { + Street string `json:"street"` + Postcode string `json:"postcode"` +} + +func (a *App) Greet(p Person) string { + return fmt.Sprintf("Hello %s (Age: %d)!", p.Name, p.Age) +} +``` + +The `wailsjs/go/main/App.js` file will still have the following code: + +```js title="App.js" +export function Greet(arg1) { + return window['go']['main']['App']['Greet'](arg1); +} +``` + +But the `wailsjs/go/main/App.d.ts` file will be updated with the following code: + +```ts title="App.d.ts" +import {main} from '../models'; + +export function Greet(arg1:main.Person):Promise; +``` + +As we can see, the "main" namespace is imported from a new "models.ts" file. This file contains all the struct definitions used by our bound methods. In this example, this is a `Person` struct. If we look at `models.ts`, we can see how the models are defined: + +```ts title="models.ts" +export namespace main { + + export class Address { + street: string; + postcode: string; + + static createFrom(source: any = {}) { + return new Address(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.street = source["street"]; + this.postcode = source["postcode"]; + } + } + export class Person { + name: string; + age: number; + address?: Address; + + static createFrom(source: any = {}) { + return new Person(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.name = source["name"]; + this.age = source["age"]; + this.address = this.convertValues(source["address"], Address); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } + } +} +``` + +So long as you have TypeScript as part of your frontend build configuration, you can use these models in the following way: + +```js title="mycode.js" + import {Greet} from '../wailsjs/go/main/App' + import {main} from '../wailsjs/go/models' + + function generate() { + let person = new main.Person() + person.name = "Peter" + person.age = 27 + Greet(person).then((result) => { + console.log(result) + }) + } +``` + +The combination of generated bindings and TypeScript models makes for a powerful development environment. + +More information on Binding can be found in the [Binding Methods](guides/application-development.mdx#binding-methods) section of the [Application Development Guide](guides/application-development.mdx). + +### Calling runtime methods + +The Javascript runtime is located at `window.runtime` and contains many methods to do various tasks such as emit an event or perform logging operations: + +```js title="mycode.js" +window.runtime.EventsEmit("my-event", 1); +``` + +More details about the JS runtime can be found in the [Runtime Reference](reference/runtime/intro). + +[^1]: There is a very small subset of libraries that use features unsupported in WebViews. There are often alternatives and workarounds for such cases. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/introduction.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/introduction.mdx new file mode 100644 index 000000000..5016196cf --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/introduction.mdx @@ -0,0 +1,59 @@ +--- +sidebar_position: 1 +--- + +# Introduction + +## Overview + +Wails is a project that enables you to write desktop apps using Go and web technologies. + +Consider it a lightweight and fast Electron alternative for Go. You can easily build applications with the flexibility and power of Go, combined with a rich, modern frontend. + +Wails doesn't hold back with the eye candy either! This is [varly](https://varly.app) - a desktop application for MacOS & Windows written using Wails. Not only does it look great, it uses native menus and translucency - everything you'd expect from a modern native app. + +

+ + + +

+ +## Quick Start Templates + +Wails comes with a number of pre-configured templates that allow you to get your application up and running quickly. There are templates for the following frameworks: Svelte, React, Vue, Preact, Lit and Vanilla. There are both Javascript and Typescript versions for each template. + +## Native Elements + +Wails uses a purpose built library for handling native elements such as Window, Menus, Dialogs, etc, so you can build good-looking, feature rich desktop applications. + +**It does not embed a browser**, so it is resource efficient. Instead, it uses the native rendering engine for the platform. On Windows, this is the new Microsoft Webview2 library, built on Chromium. + +## Go & Javascript Interoperability + +Wails automatically makes your Go methods available to Javascript, so you can call them by name from your frontend! It even generates Typescript versions of the structs used by your Go methods, so you can pass the same data structures between Go and Javascript. + +## Runtime Library + +Wails provides a runtime library, for both Go and Javascript, that handles a lot of the things modern applications need, like Eventing, Logging, Dialogs, etc. + +## Live Development Experience + +### Automatic Rebuilds + +When you run your application in "dev" mode, Wails will build your application as a native desktop application, but will read your assets from disk. It will detect any changes to your Go code and automatically rebuild and relaunch your application. + +### Automatic Reloads + +When changes to your application assets are detected, your running application will "reload", reflecting your changes almost immediately. + +### Develop your application in a Browser + +If you prefer to debug and develop in a browser then Wails has you covered. The running application also has a webserver that will run your application in any browser that connects to it. It will even refresh when your assets change on disk. + +## Production-ready Native Binaries + +When you're ready to do the final build of your application, the CLI will compile it down to a single executable, with all the assets bundled into it. On Windows and MacOS, it is possible to create a native package for distribution. The assets used in packaging (icon, info.plist, manifest file, etc) are part of your project and may be customised, giving you total control over how your applications are built. + +## Tooling + +The Wails CLI provides a hassle-free way to generate, build and bundle your applications. It will do the heavy lifting of creating icons, compiling your application with optimal settings and delivering a distributable, production ready binary. Choose from a number of starter templates to get up and running quickly! diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/_category_.json new file mode 100644 index 000000000..ebb337b83 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Reference", + "position": 40 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/cli.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/cli.mdx new file mode 100644 index 000000000..28753911f --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/cli.mdx @@ -0,0 +1,222 @@ +--- +sidebar_position: 2 +--- + +# CLI + +The Wails CLI has a number of commands that are used for managing your projects. All commands are run in the following way: + +`wails ` + +## init + +`wails init` is used for generating projects. + +| Flag | Description | Default | +|:------------------ |:----------------------------------------------------------------------------------------------------------------------- |:-------------------:| +| -n "project name" | Name of the project. **Mandatory**. | | +| -d "project dir" | Project directory to create | Name of the project | +| -g | Initialise git repository | | +| -l | List available project templates | | +| -q | Suppress output to console | | +| -t "template name" | The project template to use. This can be the name of a default template or a URL to a remote template hosted on github. | vanilla | +| -ide | Generate IDE project files | | +| -f | Force build application | false | + +Example: `wails init -n test -d mytestproject -g -ide vscode -q` + +This will generate a a project called "test" in the "mytestproject" directory, initialise git, generate vscode project files and do so silently. + +More information on using IDEs with Wails can be found [here](../guides/ides.mdx). + +### Remote Templates + +Remote templates (hosted on GitHub) are supported and can be installed by using the template's project URL. + +Example: `wails init -n test -t https://github.com/leaanthony/testtemplate[@v1.0.0]` + +A list of community maintained templates can be found [here](../community/templates.mdx) + +:::warning Attention + + **The Wails project does not maintain, is not responsible nor liable for 3rd party templates!** + + If you are unsure about a template, inspect `package.json` and `wails.json` for what scripts are run and what packages are installed. + +::: + +## build + +`wails build` is used for compiling your project to a production-ready binary. + +| Flag | Description | Default | +|:-------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------- | +| -platform | Build for the given (comma delimited) [platforms](../reference/cli.mdx#platforms) eg. `windows/arm64`. Note, if you do not give the architecture, `runtime.GOARCH` is used. | platform = `GOOS` environment variable if given else `runtime.GOOS`.
arch = `GOARCH` envrionment variable if given else `runtime.GOARCH`. | +| -clean | Cleans the `build/bin` directory | | +| -compiler "compiler" | Use a different go compiler to build, eg go1.15beta1 | go | +| -ldflags "flags" | Additional ldflags to pass to the compiler | | +| -nopackage | Do not package application | | +| -o filename | Output filename | | +| -s | Skip building the frontend | false | +| -f | Force build application | false | +| -tags "extra tags" | Build tags to pass to compiler (quoted and space separated) | | +| -upx | Compress final binary using "upx" | | +| -upxflags | Flags to pass to upx | | +| -v int | Verbosity level (0 - silent, 1 - default, 2 - verbose) | 1 | +| -webview2 | WebView2 installer strategy: download,embed,browser,error | download | +| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | | +| -debug | Retains debug information in the application. Allows the use of the devtools in the application window | false | +| -trimpath | Remove all file system paths from the resulting executable. | false | +| -race | Build with Go's race detector | false | +| -windowsconsole | Keep the console window for Windows builds | false | + +For a detailed description of the `webview2` flag, please refer to the [Windows](../guides/windows.mdx) Guide. + +If you prefer to build using standard Go tooling, please consult the [Manual Builds](../guides/manual-builds.mdx) guide. + +Example: + +`wails build -clean -o myproject.exe` + +:::info UPX on Apple Silicon + + There are [issues](https://github.com/upx/upx/issues/446) with using UPX with Apple Silicon. + +::: + +:::info UPX on Windows + + Some Antivirus vendors false positively mark `upx` compressed binaries as virus, see [issue](https://github.com/upx/upx/issues/437). + +::: + +### Platforms + +Supported platforms are: + +| Platform | Description | +|:---------------- |:--------------------------------------------- | +| darwin | MacOS + architecture of build machine | +| darwin/amd64 | MacOS 10.13+ AMD64 | +| darwin/arm64 | MacOS 11.0+ ARM64 | +| darwin/universal | MacOS AMD64+ARM64 universal application | +| windows | Windows 10/11 + architecture of build machine | +| windows/amd64 | Windows 10/11 AMD64 | +| windows/arm64 | Windows 10/11 ARM64 | +| linux | Linux + architecture of build machine | +| linux/amd64 | Linux AMD64 | +| linux/arm64 | Linux ARM64 | + + +## doctor + +`wails doctor` will run diagnostics to ensure that your system is ready for development. + +Example: +``` +Wails CLI v2.0.0-beta + +Scanning system - Please wait (this may take a long time)...Done. + +System +------ +OS: Windows 10 Pro +Version: 2009 (Build: 19043) +ID: 21H1 +Go Version: go1.17 +Platform: windows +Architecture: amd64 + +Dependency Package Name Status Version +---------- ------------ ------ ------- +WebView2 N/A Installed 93.0.961.52 +npm N/A Installed 6.14.15 +*upx N/A Installed upx 3.96 + +* - Optional Dependency + +Diagnosis +--------- +Your system is ready for Wails development! + +``` + +## dev + +`wails dev` is used to run your application in a "live development" mode. This means: + + - The application's `go.mod` will be updated to use the same version of Wails as the CLI + - The application is compiled and run automatically + - A watcher is started and will trigger a rebuild of your dev app if it detects changes to your go files + - A webserver is started on `http://localhost:34115` which serves your application (not just frontend) over http. This allows you to use your favourite browser development extensions + - All application assets are loaded from disk. If they are changed, the application will automatically reload (not rebuild). All connected browsers will also reload + - A JS module is generated that provides the following: + - Javascript wrappers of your Go methods with autogenerated JSDoc, providing code hinting + - TypeScript versions of your Go structs, that can be constructed and passed to your go methods + - A second JS module is generated that provides a wrapper + TS declaration for the runtime + +| Flag | Description | Default | +|:---------------------------- |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |:--------------------- | +| -assetdir "./path/to/assets" | Serve assets from the given directory instead of using the provided asset FS | Value in `wails.json` | +| -browser | Opens a browser to `http://localhost:34115` on startup | | +| -compiler "compiler" | Use a different go compiler to build, eg go1.15beta1 | go | +| -e | Extensions to trigger rebuilds (comma separated) | go | +| -reloaddirs | Additional directories to trigger reloads (comma separated) | Value in `wails.json` | +| -ldflags "flags" | Additional ldflags to pass to the compiler | | +| -tags "extra tags" | Build tags to pass to compiler (quoted and space separated) | | +| -loglevel "loglevel" | Loglevel to use - Trace, Debug, Info, Warning, Error | Debug | +| -noreload | Disable automatic reload when assets change | | +| -nogen | Disable generate module | | +| -v | Verbosity level (0 - silent, 1 - standard, 2 - verbose) | 1 | +| -wailsjsdir | The directory to generate the generated Wails JS modules | Value in `wails.json` | +| -debounce | The time to wait for reload after an asset change is detected | 100 (milliseconds) | +| -devserver "host:port" | The address to bind the wails dev server to | "localhost:34115" | +| -frontenddevserverurl "url" | Use 3rd party dev server url to serve assets, EG Vite | "" | +| -appargs "args" | Arguments passed to the application in shell style | | +| -save | Saves the given `assetdir`, `reloaddirs`, `wailsjsdir`, `debounce`, `devserver` and `frontenddevserverurl` flags in `wails.json` to become the defaults for subsequent invocations. | | +| -race | Build with Go's race detector | false | +| -s | Skip building the frontend | false | + +Example: + +`wails dev -assetdir ./frontend/dist -wailsjsdir ./frontend/src -browser` + +This command will do the following: + + - Build the application and run it (more details [here](../guides/manual-builds.mdx) + - Generate the Wails JS modules in `./frontend/src` + - Watch for updates to files in `./frontend/dist` and reload on any change + - Open a browser and connect to the application + +There is more information on using this feature with existing framework scripts [here](../guides/application-development.mdx#live-reloading). + +## generate + +### template + +Wails uses templates for project generation. The `wails generate template` command helps scaffold a template so that it may be used for generating projects. + +| Flag | Description | +|:---------------- |:------------------------------------------- | +| -name | The template name (Mandatory) | +| -frontend "path" | Path to frontend project to use in template | + +For more details on creating templates, consult the [Templates guide](../guides/templates.mdx). + +### module + +The `wails generate module` command allows you to manually generate the `wailsjs` directory for your application. + +## update + +`wails update` will update the version of the Wails CLI. + +| Flag | Description | +|:------------------ |:------------------------------------- | +| -pre | Update to latest pre-release version | +| -version "version" | Install a specific version of the CLI | + + +## version + +`wails version` will simply output the current CLI version. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/menus.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/menus.mdx new file mode 100644 index 000000000..7947aff58 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/menus.mdx @@ -0,0 +1,262 @@ +--- +sidebar_position: 4 +--- + +# Menus + +It is possible to add an application menu to Wails projects. This is achieved by defining a [Menu](#menu) struct and setting it in the [`Menu`](../reference/options.mdx#menu) application config, or by calling the runtime method [MenuSetApplicationMenu](../reference/runtime/menu.mdx#menusetapplicationmenu). + +An example of how to create a menu: + +```go + AppMenu := menu.NewMenu() + FileMenu := AppMenu.AddSubmenu("File") + FileMenu.AddText("&Open", keys.CmdOrCtrl("o"), openFile) + FileMenu.AddSeparator() + FileMenu.AddText("Quit", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) { + runtime.Quit() + }) + + if runtime.GOOS == "darwin" { + AppMenu.Append(menu.EditMenu()) // on macos platform, we should append EditMenu to enable Cmd+C,Cmd+V,Cmd+Z... shortcut + } + + err := wails.Run(&options.App{ + Title: "Menus Demo", + Width: 800, + Height: 600, + Menu: AppMenu, + Bind: []interface{}{ + app, + }, + ) + // ... +```` + +It is also possible to dynamically update the menu, by updating the menu struct and calling +[MenuUpdateApplicationMenu](../reference/runtime/menu.mdx#menuupdateapplicationmenu). + +The example above uses helper methods, however it's possible to build the menu structs manually. + +## Menu + +A Menu is a collection of MenuItems: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu" +type Menu struct { + Items []*MenuItem +} +``` + +For the Application menu, each MenuItem represents a single menu such as "Edit". + +A simple helper method is provided for building menus: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu" +func NewMenuFromItems(first *MenuItem, rest ...*MenuItem) *Menu +``` + +This makes the layout of the code more like that of a menu without the need to add the menu items manually after creating them. Alternatively, you can just create the menu items and add them to the menu manually. + +## MenuItem + +A MenuItem represents an item within a Menu. + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu" +// MenuItem represents a menu item contained in a menu +type MenuItem struct { + Label string + Role Role + Accelerator *keys.Accelerator + Type Type + Disabled bool + Hidden bool + Checked bool + SubMenu *Menu + Click Callback +} +``` + +| Field | Type | Notes | +| ----------- | ------------------------------------ | ------------------------------------------------------------- | +| Label | string | The menu text | +| Accelerator | [\*keys.Accelerator](#accelerator) | Key binding for this menu item | +| Type | [Type](#type) | Type of MenuItem | +| Disabled | bool | Disables the menu item | +| Hidden | bool | Hides this menu item | +| Checked | bool | Adds check to item (Checkbox & Radio types) | +| SubMenu | [\*Menu](#menu) | Sets the submenu | +| Click | [Callback](#callback) | Callback function when menu clicked | +| Role | string | Defines a [role](#role) for this menu item. Mac only for now. | + +### Accelerator + +Accelerators (sometimes called keyboard shortcuts) define a binding between a keystroke and a menu item. Wails defines an Accelerator as a combination or key + [Modifier](#modifier). They are available in the `"github.com/wailsapp/wails/v2/pkg/menu/keys"` package. + +Example: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys" + // Defines cmd+o on Mac and ctrl-o on Window/Linux + myShortcut := keys.CmdOrCtrl("o") +``` + +Keys are any single character on a keyboard with the exception of `+`, which is defined as `plus`. Some keys cannot be represented as characters so there are a set of named characters that may be used: + +- `backspace` +- `tab` +- `return` +- `enter` +- `escape` +- `left` +- `right` +- `up` +- `down` +- `space` +- `delete` +- `home` +- `end` +- `page up` +- `page down` +- `f1` +- `f2` +- `f3` +- `f4` +- `f5` +- `f6` +- `f7` +- `f8` +- `f9` +- `f10` +- `f11` +- `f12` +- `f13` +- `f14` +- `f15` +- `f16` +- `f17` +- `f18` +- `f19` +- `f20` +- `f21` +- `f22` +- `f23` +- `f24` +- `f25` +- `f26` +- `f27` +- `f28` +- `f29` +- `f30` +- `f31` +- `f32` +- `f33` +- `f34` +- `f35` +- `numlock` + +Wails also supports parsing accelerators using the same syntax as Electron. This is useful for storing accelerators in config files. + +Example: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys" + // Defines cmd+o on Mac and ctrl-o on Window/Linux + myShortcut, err := keys.Parse("Ctrl+Option+A") +``` + +#### Modifier + +The following modifiers are keys that may be used in combination with the accelerator key: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys" +const ( + // CmdOrCtrlKey represents Command on Mac and Control on other platforms + CmdOrCtrlKey Modifier = "cmdorctrl" + // OptionOrAltKey represents Option on Mac and Alt on other platforms + OptionOrAltKey Modifier = "optionoralt" + // ShiftKey represents the shift key on all systems + ShiftKey Modifier = "shift" + // ControlKey represents the control key on all systems + ControlKey Modifier = "ctrl" +) +``` +A number of helper methods are available to create Accelerators using modifiers: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys" +func CmdOrCtrl(key string) *Accelerator +func OptionOrAlt(key string) *Accelerator +func Shift(key string) *Accelerator +func Control(key string) *Accelerator +``` + +Modifiers can be combined using `keys.Combo(key string, modifier1 Modifier, modifier2 Modifier, rest ...Modifier)`: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys" + // Defines "Ctrl+Option+A" on Mac and "Ctrl+Alt+A" on Window/Linux + myShortcut := keys.Combo("a", ControlKey, OptionOrAltKey) +``` + +### Type + +Each menu item must have a type and there are 5 types available: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu" +const ( + TextType Type = "Text" + SeparatorType Type = "Separator" + SubmenuType Type = "Submenu" + CheckboxType Type = "Checkbox" + RadioType Type = "Radio" +) +``` + +For convenience, helper methods are provided to quickly create a menu item: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu" +func Text(label string, accelerator *keys.Accelerator, click Callback) *MenuItem +func Separator() *MenuItem +func Radio(label string, selected bool, accelerator *keys.Accelerator, click Callback) *MenuItem +func Checkbox(label string, checked bool, accelerator *keys.Accelerator, click Callback) *MenuItem +func SubMenu(label string, menu *Menu) *Menu +``` +You can also create menu items directly on a menu by using the "Add" helpers: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu" +func (m *Menu) AddText(label string, accelerator *keys.Accelerator, click Callback) *MenuItem +func (m *Menu) AddSeparator() *MenuItem +func (m *Menu) AddRadio(label string, selected bool, accelerator *keys.Accelerator, click Callback) *MenuItem +func (m *Menu) AddCheckbox(label string, checked bool, accelerator *keys.Accelerator, click Callback) *MenuItem +func (m *Menu) AddSubMenu(label string, menu *Menu) *MenuI +``` + + +A note on radio groups: A radio group is defined as a number of radio menu items that are next to each other in the menu. This means that you do not need to group items together as it is automatic. However, that also means you cannot have 2 radio groups next to each other - there must be a non-radio item between them. + +### Callback + +Each menu item may have a callback that is executed when the item is clicked: + +```go title="Package: github.com/wailsapp/wails/v2/pkg/menu" +type Callback func(*CallbackData) + +type CallbackData struct { + MenuItem *MenuItem +} +``` + +The function is given a `CallbackData` struct which indicates which menu item triggered the callback. This is useful when using radio groups that may share a callback. + +### Role + +:::info Roles + + Roles are currently supported on Mac only. + +::: + +A menu item may have a role, which is essentially a pre-defined menu item. We currently support the following roles: + +| Role | Description | +| ------------ | ------------------------------------------------------------------------ | +| AppMenuRole | The standard Mac application menu. Can be created using `menu.AppMenu()` | +| EditMenuRole | The standard Mac edit menu. Can be created using `menu.EditMenu()` | + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/options.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/options.mdx new file mode 100644 index 000000000..b9d424e16 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/options.mdx @@ -0,0 +1,697 @@ +--- +sidebar_position: 3 +--- + +# Options + +## Application Options + +The `Options.App` struct contains the application configuration. It is passed to the `wails.Run()` method: + +```go title="Example" +import "github.com/wailsapp/wails/v2/pkg/options" + +func main() { + + err := wails.Run(&options.App{ + Title: "Menus Demo", + Width: 800, + Height: 600, + DisableResize: false, + Fullscreen: false, + Frameless: true, + MinWidth: 400, + MinHeight: 400, + MaxWidth: 1280, + MaxHeight: 1024, + StartHidden: false, + HideWindowOnClose: false, + BackgroundColour: &options.RGBA{R: 0, G: 0, B: 0, A: 255}, + AlwaysOnTop: false, + Assets: assets, + AssetsHandler: assetsHandler, + Menu: app.applicationMenu(), + Logger: nil, + LogLevel: logger.DEBUG, + LogLevelProduction: logger.ERROR, + OnStartup: app.startup, + OnDomReady: app.domready, + OnShutdown: app.shutdown, + OnBeforeClose: app.beforeClose, + WindowStartState: options.Maximised, + Bind: []interface{}{ + app, + }, + Windows: &windows.Options{ + WebviewIsTransparent: false, + WindowIsTranslucent: false, + DisableWindowIcon: false, + DisableFramelessWindowDecorations: false, + WebviewUserDataPath: "", + WebviewBrowserPath: "", + Theme: windows.SystemDefault, + CustomTheme: &windows.ThemeSettings{ + DarkModeTitleBar: windows.RGB(20, 20, 20), + DarkModeTitleText: windows.RGB(200, 200, 200), + DarkModeBorder: windows.RGB(20, 0, 20), + LightModeTitleBar: windows.RGB(200, 200, 200), + LightModeTitleText: windows.RGB(20, 20, 20), + LightModeBorder: windows.RGB(200, 200, 200), + }, + // User messages that can be customised + Messages *windows.Messages + }, + Mac: &mac.Options{ + TitleBar: &mac.TitleBar{ + TitlebarAppearsTransparent: true, + HideTitle: false, + HideTitleBar: false, + FullSizeContent: false, + UseToolbar: false, + HideToolbarSeparator: true, + }, + Appearance: mac.NSAppearanceNameDarkAqua, + WebviewIsTransparent: true, + WindowIsTranslucent: false, + About: &mac.AboutInfo{ + Title: "My Application", + Message: "© 2021 Me", + Icon: icon, + }, + }, + Linux: &linux.Options{ + Icon: icon, + }, + }) + if err != nil { + log.Fatal(err) + } +} + +``` + + + +### Title + +Name: Title + +Type: string + +The text shown in the window's title bar. + +### Width + +Name: Width + +Type: int + +The initial width of the window. Default: 1024. + +### Height + +Name: Height + +Type: int + +The initial height of the window. Default: 768 + +### DisableResize + +Name: DisableResize + +Type: bool + +By default, the main window is resizable. Setting this to `true` will keep it a fixed size. + +### Fullscreen + +Name: Fullscreen + +Type: bool + +Setting this to `true` will make the window fullscreen at startup. + +### Frameless + +Name: Frameless + +Type: bool + +When set to `true`, the window will have no borders or title bar. Also see [Frameless Windows](../guides/frameless.mdx). + +### MinWidth + +Name: MinWidth + +Type: int + +This sets the minimum width for the window. If the value given in `Width` is less than this value, the window will be set to `MinWidth` by default. + +### MinHeight + +Name: MinHeight + +Type: int + +This sets the minimum height for the window. If the value given in `Height` is less than this value, the window will be set to `MinHeight` by default. + +### MaxWidth + +Name: MaxWidth + +Type: int + +This sets the maximum width for the window. If the value given in `Width` is more than this value, the window will be set to `MaxWidth` by default. + +### MaxHeight + +Name: MaxHeight + +Type: int + +This sets the maximum height for the window. If the value given in `Height` is more than this value, the window will be set to `MaxHeight` by default. + +### StartHidden + +Name: StartHidden + +Type: bool + +When set to `true`, the application will be hidden until [WindowShow](../reference/runtime/window.mdx#windowshow) is called. + +### HideWindowOnClose + +Name: HideWindowOnClose + +Type: bool + +By default, closing the window will close the application. Setting this to `true` means closing the window will hide the window instead. + +### BackgroundColour + +Name: BackgroundColour + +Type: *options.RGBA Example: options.NewRGBA(255,0,0,128) - Red at 50% transparency + +This value is the default background colour of the window. Default: white + +### AlwaysOnTop + +Name: AlwaysOnTop + +Type: bool + +Indicates that the window should stay above other windows when losing focus. + +### Assets + +Name: Assets + +Type: embed.FS + +The frontend assets to be used by the application. Requires an `index.html` file. + +### AssetsHandler + + + +Name: AssetsHandler + +Type: http.Handler + + +The assets handler is a generic `http.Handler` which will be called for any non GET request on the assets server and for GET requests which can not be served from the `assets` because the file is not found. + +| Value | Win | Mac | Lin | +| ----------------------- | --- | --- | --- | +| GET | ✅ | ✅ | ✅ | +| POST | ✅ | ✅ | ❌ | +| PUT | ✅ | ✅ | ❌ | +| PATCH | ✅ | ✅ | ❌ | +| DELETE | ✅ | ✅ | ❌ | +| Request Headers | ✅ | ✅ | ❌ | +| Request Body | ✅ | ✅ | ❌ | +| Request Body Streaming | ❌ | ❌ | ❌ | +| Response StatusCodes | ✅ | ✅ | ❌ | +| Response Headers | ✅ | ✅ | ❌ | +| Response Body | ✅ | ✅ | ✅ | +| Response Body Streaming | ❌ | ❌ | ✅ | + +NOTE: Linux is currently very limited due to targeting a WebKit2GTK Version < 2.36.0. In the future some features will be supported by the introduction of WebKit2GTK 2.36.0+ support. + +NOTE: When used in combination with a Frontend DevServer there might be limitations, eg. Vite serves the index.html on every path, that does not contain a file extension. + +### Menu + +Name: Menu + +Type: \*menu.Menu + +The menu to be used by the application. More details about Menus in the [Menu Reference](../reference/runtime/menu.mdx). + +NOTE: On Mac, if no menu is specified, a default menu will be created. + +### Logger + +Name: Logger + +Type: logger.Logger + +Default: Logger to Stdout + +The logger to be used by the application. More details about logging in the [Log Reference](../reference/runtime/log.mdx). + +### LogLevel + +Name: LogLevel + +Type: logger.LogLevel + +Default: `Info` in dev mode, `Error` in production mode + +The default log level. More details about logging in the [Log Reference](../reference/runtime/log.mdx). + +### LogLevelProduction + +Name: LogLevelProduction + +Type: logger.LogLevel + +Default: `Error` + +The default log level for production builds. More details about logging in the [Log Reference](../reference/runtime/log.mdx). + +### OnStartup + +Name: OnStartup + +Type: func(ctx context.Context) + +This callback is called after the frontend has been created, but before `index.html` has been loaded. It is given the application context. + +### OnDomReady + +Name: OnDomReady + +Type: func(ctx context.Context) + +This callback is called after the frontend has loaded `index.html` and its resources. It is given the application context. + +### OnShutdown + +Name: OnShutdown + +Type: func(ctx context.Context) + +This callback is called after the frontend has been destroyed, just before the application terminates. It is given the application context. + +### OnBeforeClose + +Name: OnBeforeClose + +Type: func(ctx context.Context) bool + +If this callback is set, it will be called when the application is about to quit, either by clicking the window close button or calling `runtime.Quit`. Returning true will cause the application to continue, false will continue shutdown as normal. This is good for confirming with the user that they wish to exit the program. + +Example: +```go title=windowsapp.go +func (b *App) beforeClose(ctx context.Context) (prevent bool) { + dialog, err := runtime.MessageDialog(ctx, runtime.MessageDialogOptions{ + Type: runtime.QuestionDialog, + Title: "Quit?", + Message: "Are you sure you want to quit?", + }) + + if err != nil { + return false + } + return dialog != "Yes" +} +``` + +### WindowStartState + +Name: WindowStartState + +Type: options.WindowStartState + +Defines how the window should present itself at startup. + +| Value | Win | Mac | Lin | +| ---------- | --- | --- | --- | +| Fullscreen | ✅ | ✅ | ✅ | +| Maximised | ✅ | ✅ | ✅ | +| Minimised | ✅ | ❌ | ✅ | + +### Bind + +Name: Bind + +Type: []interface{} + +A slice of struct instances defining methods that need to be bound to the frontend. + +### Windows + +Name: Windows + +Type: \*windows.Options + +This defines [Windows specific options](#windows-specific-options). + +### Mac + +Name: Mac + +Type: \*mac.Options + +This defines [Mac specific options](#mac-specific-options). + +### Linux + +Name: Linux + +Type: \*linux.Options + +This defines [Linux specific options](#linux-specific-options). + +## Windows Specific Options + +### WebviewIsTransparent + +Name: WebviewIsTransparent + +Type: bool + +Setting this to `true` will make the webview background transparent when an alpha value of `0` is used. This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through. Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications. + +### WindowIsTranslucent + +Name: WindowIsTranslucent + +Type: bool + +Setting this to `true` will make the window background translucent. Often combined with [WebviewIsTransparent](#WebviewIsTransparent) to make frosty-looking applications. + +### DisableWindowIcon + +Name: DisableWindowIcon + +Type: bool + +Setting this to `true` will remove the icon in the top left corner of the title bar. + +### DisableFramelessWindowDecorations + +Name: DisableFramelessWindowDecorations + +Type: bool + +Setting this to `true` will remove the window decorations in [Frameless](#Frameless) mode. This means there will be no 'Aero Shadow' and no 'Rounded Corners' shown for the window. Please note that 'Rounded Corners' are only supported on Windows 11. + +### WebviewUserDataPath + +Name: WebviewUserDataPath + +Type: string + +This defines the path where the WebView2 stores the user data. If empty `%APPDATA%\[BinaryName.exe]` will be used. + +### WebviewBrowserPath + +Name: WebviewBrowserPath + +Type: string + +This defines the path to a directory with WebView2 executable files and libraries. If empty, webview2 installed in the system will be used. + +Important information about distribution of fixed version runtime: +- [How to get and extract runtime](https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#details-about-the-fixed-version-runtime-distribution-mode) +- [Known issues for fixed version](https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#known-issues-for-fixed-version) +- [The path of fixed version of the WebView2 Runtime should not contain \Edge\Application\.](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.1245.22#createcorewebview2environmentwithoptions) + +### Theme + +Name: Theme + +Type: `windows.Theme` + +Minimum Windows Version: Windows 10 2004/20H1 + +This defines the theme that the application should use: + +| Value | Description | +| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| SystemDefault | *Default*. The theme will be based on the system default. If the user changes their theme, the application will update to use the new setting | +| Dark | The application will use a dark theme exclusively | +| Light | The application will use a light theme exclusively | + + +### CustomTheme + +Name: CustomTheme + +Type: `windows.CustomTheme` + +Minimum Windows Version: Windows 10/11 2009/21H2 Build 22000 + +Allows you to specify custom colours for TitleBar, TitleText and Border for both light and dark mode, as well as when the window is active or inactive. + +#### CustomTheme + +The CustomTheme struct uses `int32` to specify the colour values. These are in the standard(!) Windows format of: `0x00BBGGAA`. A helper function is provided to do RGB conversions into this format: `windows.RGB(r,g,b uint8)`. + +NOTE: Any value not provided will default to black. + +```go +type ThemeSettings struct { + DarkModeTitleBar int32 + DarkModeTitleBarInactive int32 + DarkModeTitleText int32 + DarkModeTitleTextInactive int32 + DarkModeBorder int32 + DarkModeBorderInactive int32 + LightModeTitleBar int32 + LightModeTitleBarInactive int32 + LightModeTitleText int32 + LightModeTitleTextInactive int32 + LightModeBorder int32 + LightModeBorderInactive int32 +} +``` + +Example: +```go + CustomTheme: &windows.ThemeSettings{ + // Theme to use when window is active + DarkModeTitleBar: windows.RGB(255, 0, 0), // Red + DarkModeTitleText: windows.RGB(0, 255, 0), // Green + DarkModeBorder: windows.RGB(0, 0, 255), // Blue + LightModeTitleBar: windows.RGB(200, 200, 200), + LightModeTitleText: windows.RGB(20, 20, 20), + LightModeBorder: windows.RGB(200, 200, 200), + // Theme to use when window is inactive + DarkModeTitleBarInactive: windows.RGB(128, 0, 0), + DarkModeTitleTextInactive: windows.RGB(0, 128, 0), + DarkModeBorderInactive: windows.RGB(0, 0, 128), + LightModeTitleBarInactive: windows.RGB(100, 100, 100), + LightModeTitleTextInactive: windows.RGB(10, 10, 10), + LightModeBorderInactive: windows.RGB(100, 100, 100), + }, +``` + +### Messages + +Name: Messages + +Type: `*windows.Messages` + +A struct of strings used by the webview2 installer if a valid webview2 runtime is not found. Customise this for any language you choose to support. + +### ResizeDebounceMS + +Name: ResizeDebounceMS + +Type: uint16 + +ResizeDebounceMS is the amount of time to debounce redraws of webview2 when resizing the window. The default value (0) will perform redraws as fast as it can. + +### OnSuspend + +Name: OnSuspend + +Type: func() + +If set, this function will be called when windows initiates a switch to low power mode (suspend/hibernate) + +### OnResume + +Name: OnResume + +Type: func() + +If set, this function will be called when windows resumes from low power mode (suspend/hibernate) + + + +## Mac Specific Options + +### TitleBar + +Name: TitleBar + +Type: [*mac.TitleBar](#titlebar-struct) + +The TitleBar struct provides the ability to configure the look and feel of the title bar. + +### Appearance + +Name: Appearance + +Type: [AppearanceType](#appearance-type) + +Appearance is used to set the style of your app in accordance with Apple's [NSAppearance](https://developer.apple.com/documentation/appkit/nsappearancename?language=objc) names. + +### WebviewIsTransparent + +Name: WebviewIsTransparent + +Type: bool + +Setting this to `true` will make the webview background transparent when an alpha value of `0` is used. This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through. Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications. + +### WindowIsTranslucent + +Name: WindowIsTranslucent + +Type: bool + +Setting this to `true` will make the window background translucent. Often combined with [WebviewIsTransparent](#WebviewIsTransparent) to make frosty-looking applications. + +### About + +Name: About + +Type: [About](#about-struct) + +This configuration lets you set the title, message and icon for the "About" menu item in the app menu created by the "AppMenu" role. + +#### Titlebar struct + +The titlebar of the application can be customised by using the TitleBar options: + +```go +type TitleBar struct { + TitlebarAppearsTransparent bool + HideTitle bool + HideTitleBar bool + FullSizeContent bool + UseToolbar bool + HideToolbarSeparator bool +} +``` + +| Name | Description | +| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| TitlebarAppearsTransparent | Makes the titlebar transparent. This has the effect of hiding the titlebar and the content fill the window. [Apple Docs](https://developer.apple.com/documentation/appkit/nswindow/1419167-titlebarappearstransparent?language=objc) | +| HideTitle | Hides the title of the window. [Apple Docs](https://developer.apple.com/documentation/appkit/nswindowtitlevisibility?language=objc) | +| HideTitleBar | Removes [NSWindowStyleMaskTitled](https://developer.apple.com/documentation/appkit/nswindowstylemask/nswindowstylemasktitled/) from the style mask | +| FullSizeContent | Makes the webview fill the entire window. [Apple Docs](https://developer.apple.com/documentation/appkit/nswindowstylemask/nswindowstylemaskfullsizecontentview) | +| UseToolbar | Adds a default toolbar to the window. [Apple Docs](https://developer.apple.com/documentation/appkit/nstoolbar?language=objc) | +| HideToolbarSeparator | Removes the line beneath the toolbar. [Apple Docs](https://developer.apple.com/documentation/appkit/nstoolbar/1516954-showsbaselineseparator?language=objc) | + +Preconfigured titlebar settings are available: + +| Setting | Example | +| --------------------------- | --------------------------------------------- | +| `mac.TitleBarDefault()` | ![](/img/reference/titlebar-default.png) | +| `mac.TitleBarHidden()` | ![](/img/reference/titlebar-hidden.png) | +| `mac.TitleBarHiddenInset()` | ![](/img/reference/titlebar-hidden-inset.png) | + +Example: +```go +Mac: &mac.Options{ + TitleBar: mac.TitleBarHiddenInset(), +} +``` + +Click [here](https://github.com/lukakerr/NSWindowStyles) for some inspiration on customising the titlebar. + +#### Appearance type + +You can specify the application's [appearance](https://developer.apple.com/documentation/appkit/nsappearance?language=objc). + +| Value | Description | +| ----------------------------------------------------- | --------------------------------------------------------------- | +| DefaultAppearance | DefaultAppearance uses the default system value | +| NSAppearanceNameAqua | The standard light system appearance | +| NSAppearanceNameDarkAqua | The standard dark system appearance | +| NSAppearanceNameVibrantLight | The light vibrant appearance | +| NSAppearanceNameAccessibilityHighContrastAqua | A high-contrast version of the standard light system appearance | +| NSAppearanceNameAccessibilityHighContrastDarkAqua | A high-contrast version of the standard dark system appearance | +| NSAppearanceNameAccessibilityHighContrastVibrantLight | A high-contrast version of the light vibrant appearance | +| NSAppearanceNameAccessibilityHighContrastVibrantDark | A high-contrast version of the dark vibrant appearance | + +Example: +```go +Mac: &mac.Options{ + Appearance: mac.NSAppearanceNameDarkAqua, +} +``` + +#### About struct + +```go +type AboutInfo struct { + Title string + Message string + Icon []byte +} +``` +If these settings are provided, an "About" menu item will appear in the app menu (when using the `AppMenu` role). Given this configuration: +```go +//go:embed build/appicon.png +var icon []byte + +func main() { + err := wails.Run(&options.App{ + ... + Mac: &mac.Options{ + About: &mac.AboutInfo{ + Title: "My Application", + Message: "© 2021 Me", + Icon: icon, + }, + }, + }) +``` +The "About" menu item will appear in the app menu: + +
+ +
+ +
+ +When clicked, that will open an about message box: + +
+ +
+ +
+ +## Linux Specific Options + +### Icon + +Name: Icon + +Type: []byte + +Sets up the icon representing the window. This icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. On others, the icon is not used at all, so your mileage may vary. + +NOTE: Gnome on Wayland at least does not display this icon. To have a application icon there, a `.desktop` file has to be used. On KDE it should work. + +The icon should be provided in whatever size it was naturally drawn; that is, don’t scale the image before passing it. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/project-config.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/project-config.mdx new file mode 100644 index 000000000..886d14e55 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/project-config.mdx @@ -0,0 +1,51 @@ +--- +sidebar_position: 5 +--- + +# Project Config + +The project config resides in the `wails.json` file in the project directory. The structure of the config is: + +```json +{ + "name": "[The project name]", + "assetdir": "[Relative path to the directory containing the compiled assets, this is normally inferred and could be left empty]", + "reloaddirs": "[Additional directories to trigger reloads (comma separated), this is only used for some advanced asset configurations]", + "frontend:install": "[The command to install node dependencies, run in the frontend directory - often `npm install`]", + "frontend:build": "[The command to build the assets, run in the frontend directory - often `npm run build`]", + "frontend:dev": "[This command has been replaced by frontend:dev:build. If frontend:dev:build is not specified will falls back to this command. If this command is also not specified will falls back to frontend:build]", + "frontend:dev:build": "[This command is the dev equivalent of frontend:build. If not specified falls back to frontend:dev]", + "frontend:dev:install": "[This command is the dev equivalent of frontend:install. If not specified falls back to frontend:install]", + "frontend:dev:watcher": "[This command is run in a separate process on `wails dev`. Useful for 3rd party watchers or starting 3d party dev servers]", + "frontend:dev:serverUrl": "[URL to a 3rd party dev server to be used to serve assets, EG Vite. If this is set to 'auto' then the devServerUrl will be inferred from the Vite output]", + "wailsjsdir": "[Relative path to the directory that the auto-generated JS modules will be created]", + "version": "[Project config version]", + "outputfilename": "[The name of the binary]", + "debounceMS": 100, // The default time the dev server waits to reload when it detects a change in assets + "devServer": "[Address to bind the wails dev sever to. Default: localhost:34115]", + "appargs": "[Arguments passed to the application in shell style when in dev mode]", + "runNonNativeBuildHooks": false, // Defines if build hooks should be run though they are defined for an OS other than the host OS. + "preBuildHooks": { + "GOOS/GOARCH": "[The command that will be executed before a build of the specified GOOS/GOARCH: ${platform} is replaced with the "GOOS/GOARCH". The "GOOS/GOARCH" hook is executed before the "GOOS/*" and "*/*" hook.]", + "GOOS/*": "[The command that will be executed before a build of the specified GOOS: ${platform} is replaced with the "GOOS/GOARCH". The "GOOS/*" hook is executed before the "*/*" hook.]", + "*/*": "[The command that will be executed before every build: ${platform} is replaced with the "GOOS/GOARCH".]" + }, + "postBuildHooks": { + "GOOS/GOARCH": "[The command that will be executed after a build of the specified GOOS/GOARCH: ${platform} is replaced with the "GOOS/GOARCH" and ${bin} with the path to the compiled binary. The "GOOS/GOARCH" hook is executed before the "GOOS/*" and "*/*" hook.]", + "GOOS/*": "[The command that will be executed after a build of the specified GOOS: ${platform} is replaced with the "GOOS/GOARCH" and ${bin} with the path to the compiled binary. The "GOOS/*" hook is executed before the "*/*" hook.]", + "*/*": "[The command that will be executed after every build: ${platform} is replaced with the "GOOS/GOARCH" and ${bin} with the path to the compiled binary.]" + }, + "info": { // Data used to populate manifests and version info. + "companyName": "[The company name. Default: [The project name]]", + "productName": "[The product name. Default: [The project name]]", + "productVersion": "[The version of the product. Default: '1.0.0']", + "copyright": "[The copyright of the product. Default: 'Copyright.........']", + "comments": "[A short comment of the app. Default: 'Built using Wails (https://wails.app)']" + }, + "nsisType": "['multiple': One installer per architecture. 'single': Single universal installer for all architectures being built. Default: 'multiple']" +} +``` + +This file is read by the Wails CLI when running `wails build` or `wails dev`. + +The `assetdir`, `reloaddirs`, `wailsjsdir`, `debounceMS`, `devserver` and `frontenddevserverurl` flags in `wails build/dev` will update the project config and thus become defaults for subsequent runs. \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/_category_.json new file mode 100644 index 000000000..ac6d55488 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Runtime", + "position": 1 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/browser.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/browser.mdx new file mode 100644 index 000000000..1cb407d49 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/browser.mdx @@ -0,0 +1,20 @@ +--- +sidebar_position: 7 +--- + +# Browser + +## Overview + +These methods are related to the system browser. + +### BrowserOpenURL +Go Signature: `BrowserOpenURL(ctx context.Context, url string)` + +JS Signature: `BrowserOpenURL(url string)` + +Opens the given URL in the system browser. + + + + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx new file mode 100644 index 000000000..8f05ec2e6 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx @@ -0,0 +1,262 @@ +--- +sidebar_position: 5 +--- + +# Dialog + +## Overview + +This part of the runtime provides access to native dialogs, such as File Selectors and Message boxes. + +:::info Javascript + Dialog is currently unsupported in the JS runtime. +::: + +### OpenDirectoryDialog + +Opens a dialog that prompts the user to select a directory. Can be customised using [OpenDialogOptions](#opendialogoptions). + +Go Signature: `OpenDirectoryDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)` + +Returns: Selected directory (blank if the user cancelled) or an error + + +### OpenFileDialog + +Opens a dialog that prompts the user to select a file. Can be customised using [OpenDialogOptions](#opendialogoptions). + +Go Signature: `OpenFileDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)` + +Returns: Selected file (blank if the user cancelled) or an error + + + +### OpenMultipleFilesDialog + +Opens a dialog that prompts the user to select multiple files. Can be customised using [OpenDialogOptions](#opendialogoptions). + +Go Signature: `OpenMultipleFilesDialog(ctx context.Context, dialogOptions OpenDialogOptions) ([]string, error)` + +Returns: Selected files (nil if the user cancelled) or an error + + + +### SaveFileDialog + +Opens a dialog that prompts the user to select a filename for the purposes of saving. Can be customised using [SaveDialogOptions](#savedialogoptions). + +Go Signature: `SaveFileDialog(ctx context.Context, dialogOptions SaveDialogOptions) (string, error)` + +Returns: The selected file (blank if the user cancelled) or an error + + + +### MessageDialog + +Displays a message using a message dialog. Can be customised using [MessageDialogOptions](#messagedialogoptions). + +Go Signature: `MessageDialog(ctx context.Context, dialogOptions MessageDialogOptions) (string, error)` + +Returns: The text of the selected button or an error + +## Options + +### OpenDialogOptions + +```go +type OpenDialogOptions struct { + DefaultDirectory string + DefaultFilename string + Title string + Filters []FileFilter + ShowHiddenFiles bool + CanCreateDirectories bool + ResolvesAliases bool + TreatPackagesAsDirectories bool +} +``` +| Field | Description | Win | Mac | Lin | +| -------------------------- | ---------------------------------------------- | --- | --- | --- | +| DefaultDirectory | The directory the dialog will show when opened | ✅ | ✅ | ✅ | +| DefaultFilename | The default filename | ✅ | ✅ | ✅ | +| Title | Title for the dialog | ✅ | ✅ | ✅ | +| [Filters](#filefilter) | A list of file filters | ✅ | ✅ | ✅ | +| ShowHiddenFiles | Show files hidden by the system | | ✅ | ✅ | +| CanCreateDirectories | Allow user to create directories | | ✅ | | +| ResolvesAliases | If true, returns the file not the alias | | ✅ | | +| TreatPackagesAsDirectories | Allow navigating into packages | | ✅ | | + + +### SaveDialogOptions + +```go +type SaveDialogOptions struct { + DefaultDirectory string + DefaultFilename string + Title string + Filters []FileFilter + ShowHiddenFiles bool + CanCreateDirectories bool + TreatPackagesAsDirectories bool +} +``` + +| Field | Description | Win | Mac | Lin | +| -------------------------- | ---------------------------------------------- | --- | --- | --- | +| DefaultDirectory | The directory the dialog will show when opened | ✅ | ✅ | ✅ | +| DefaultFilename | The default filename | ✅ | ✅ | ✅ | +| Title | Title for the dialog | ✅ | ✅ | ✅ | +| [Filters](#filefilter) | A list of file filters | ✅ | ✅ | ✅ | +| ShowHiddenFiles | Show files hidden by the system | | ✅ | ✅ | +| CanCreateDirectories | Allow user to create directories | | ✅ | | +| TreatPackagesAsDirectories | Allow navigating into packages | | ✅ | | + +### MessageDialogOptions + +```go +type MessageDialogOptions struct { + Type DialogType + Title string + Message string + Buttons []string + DefaultButton string + CancelButton string +} +``` +| Field | Description | Win | Mac | Lin | +| ------------- | ------------------------------------------------------------------------- | --- | --- | --- | +| Type | The type of message dialog, eg question, info... | ✅ | ✅ | ✅ | +| Title | Title for the dialog | ✅ | ✅ | ✅ | +| Message | The message to show the user | ✅ | ✅ | ✅ | +| Buttons | A list of button titles | | ✅ | | +| DefaultButton | The button with this text should be treated as default. Bound to `return` | | ✅ | | +| CancelButton | The button with this text should be treated as cancel. Bound to `escape` | | ✅ | | + +#### Windows + +Windows has standard dialog types in which the buttons are not customisable. The value returned will be one of: "Ok", "Cancel", "Abort", "Retry", "Ignore", "Yes", "No", "Try Again" or "Continue" + +#### Linux + +Linux has standard dialog types in which the buttons are not customisable. The value returned will be one of: "Ok", "Cancel", "Yes", "No" + +#### Mac + +A message dialog on Mac may specify up to 4 buttons. If no `DefaultButton` or `CancelButton` is given, the first button is considered default and is bound to the `return` key. + +For the following code: +```go +selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{ + Title: "It's your turn!", + Message: "Select a number", + Buttons: []string{"one", "two", "three", "four"}, +}) +``` +the first button is shown as default: +
+ +
+ +
+ +And if we specify `DefaultButton` to be "two": +```go +selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{ + Title: "It's your turn!", + Message: "Select a number", + Buttons: []string{"one", "two", "three", "four"}, + DefaultButton: "two", +}) +``` +the second button is shown as default. When `return` is pressed, the value "two" is returned. +
+ +
+ +
+ +If we now specify `CancelButton` to be "three": +```go +selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{ + Title: "It's your turn!", + Message: "Select a number", + Buttons: []string{"one", "two", "three", "four"}, + DefaultButton: "two", + CancelButton: "three", +}) +``` +the button with "three" is shown at the bottom of the dialog. When `escape` is pressed, the value "three" is returned: +
+ +
+ +
+
+
+ + +#### DialogType + +```go +const ( + InfoDialog DialogType = "info" + WarningDialog DialogType = "warning" + ErrorDialog DialogType = "error" + QuestionDialog DialogType = "question" + ) +``` + +### FileFilter + +```go +type FileFilter struct { + DisplayName string // Filter information EG: "Image Files (*.jpg, *.png)" + Pattern string // semi-colon separated list of extensions, EG: "*.jpg;*.png" +} +``` + +#### Windows + +Windows allows you to use multiple file filters in dialog boxes. Each FileFilter will show up as a separate entry in the dialog: + +
+ +
+ +
+
+
+ +#### Linux + +Linux allows you to use multiple file filters in dialog boxes. Each FileFilter will show up as a separate entry in the dialog: + +
+ +
+ +
+
+
+ + +#### Mac + +Mac dialogs only have the concept of a single set of patterns to filter files. If multiple FileFilters are provided, Wails will use all the Patterns defined. + +Example: +```go + selection, err := runtime.OpenFileDialog(b.ctx, runtime.OpenDialogOptions{ + Title: "Select File", + Filters: []runtime.FileFilter{ + { + DisplayName: "Images (*.png;*.jpg)", + Pattern: "*.png;*.jpg", + }, { + DisplayName: "Videos (*.mov;*.mp4)", + Pattern: "*.mov;*.mp4", + }, + }, + }) +``` +This will result in the Open File dialog using `*.png,*.jpg,*.mov,*.mp4` as a filter. \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/events.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/events.mdx new file mode 100644 index 000000000..140d0135e --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/events.mdx @@ -0,0 +1,49 @@ +--- +sidebar_position: 2 +--- + +# Events + +## Overview + +The Wails runtime provides a unified events system, where events can be emitted or received by either Go or Javascript. Optionally, data may be passed with the events. Listeners will receive the data in the local data types. + +### EventsOn + +Go Signature: `EventsOn(ctx context.Context, eventName string, callback func(optionalData ...interface{}))` + +JS Signature: `EventsOn(eventName string, callback function(optionalData?: any))` + +This method sets up a listener for the given event name. When an event of type `eventName` is [emitted](#EventsEmit), the callback is triggered. Any additional data sent with the emitted event will be passed to the callback. + +### EventsOff + +Go Signature: `EventsOff(ctx context.Context, eventName string)` + +JS Signature: `EventsOff(eventName string)` + +This method unregisters the listener for the given event name. + +### EventsOnce + +Go Signature: `EventsOnce(ctx context.Context, eventName string, callback func(optionalData ...interface{}))` + +JS Signature: `EventsOnce(eventName string, callback function(optionalData?: any))` + +This method sets up a listener for the given event name, but will only trigger once. + +### EventsOnMultiple + +Go Signature: `EventsOnMultiple(ctx context.Context, eventName string, callback func(optionalData ...interface{}), counter int)` + +JS Signature: `EventsOnMultiple(eventName string, callback function(optionalData?: any), counter int)` + +This method sets up a listener for the given event name, but will only trigger a maximum of `counter` times. + +### EventsEmit + +Go Signature: `EventsEmit(ctx context.Context, eventName string, optionalData ...interface{})` + +JS Signature: `EventsEmit(ctx context, optionalData function(optionalData?: any))` + +This method emits the given event. Optional data may be passed with the event. This will trigger any event listeners. diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/intro.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/intro.mdx new file mode 100644 index 000000000..188daab06 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/intro.mdx @@ -0,0 +1,55 @@ +--- +sidebar_position: 1 +--- + +# Introduction + +The runtime is a library that provides utility methods for your application. There is both a Go and Javascript runtime and the aim is to try and keep them at parity where possible. + +The Go Runtime is available through importing `github.com/wailsapp/wails/v2/pkg/runtime`. All methods in this package take a context as the first parameter. This context should be obtained from the [OnStartup](../options.mdx#onstartup) or [OnDomReady](../options.mdx#ondomready) hooks. + +:::info Note + +Whilst the context will be provided to the [OnStartup](../options.mdx#onstartup) method, there's no guarantee the runtime will work in this method as the window is initialising in a different thread. If you wish to call runtime methods at startup, use [OnDomReady](../options.mdx#ondomready). + +::: + +The Javascript library is available to the frontend via the `window.runtime` map. There is a runtime package generated when using `dev` mode that provides Typescript declarations for the runtime. This should be located in the `wailsjs` directory in your frontend directory. + +### Hide + +Go Signature: `Hide(ctx context.Context)` + +Hides the application. + +:::info Note On Mac, this will hide the application in the same way as the `Hide` menu item in standard Mac applications. This is different to hiding the window, but the application still being in the foreground. For Windows and Linux, this is currently the same as `WindowHide`. ::: + +### Show + +Go Signature: `Show(ctx context.Context)` + +Shows the application. + +:::info Note On Mac, this will bring the application back into the foreground. For Windows and Linux, this is currently the same as `WindowShow`. ::: + +### Quit + +Go Signature: `Quit(ctx context.Context)` + +Quits the application. + +### Environment + +Go Signature: `Environment(ctx context.Context) EnvironmentInfo` + +Returns details of the current environment. + +#### EnvironmentInfo + +```go +type EnvironmentInfo struct { + BuildType string // Either "production", "debug" or "dev" +} +``` + + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/log.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/log.mdx new file mode 100644 index 000000000..d08285c91 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/log.mdx @@ -0,0 +1,149 @@ +--- +sidebar_position: 3 +--- + +# Log + +## Overview + +The Wails runtime provides a logging mechanism that may be called from Go or Javascript. Like most loggers, there are a number of log levels: + + - Trace + - Debug + - Info + - Warning + - Error + - Fatal + +The logger will output any log message at the current, or higher, log level. Example: The `Debug` log level will output all messages except `Trace` messages. + +### LogPrint + +Go Signature: `LogPrint(ctx context.Context, message string)` + +JS Signature: `LogPrint(message: string)` + +Logs the given message as a raw message. + +### LogPrintf + +Go Signature: `LogPrintf(ctx context.Context, format string, args ...interface{})` + +Logs the given message as a raw message. + +### LogTrace + +Go Signature: `LogTrace(ctx context.Context, message string)` + +JS Signature: `LogTrace(message: string)` + +Logs the given message at the `Trace` log level. + +### LogTracef + +Go Signature: `LogTracef(ctx context.Context, format string, args ...interface{})` + +Logs the given message at the `Trace` log level. + +### LogDebug + +Go Signature: `LogDebug(ctx context.Context, message string)` + +JS Signature: `LogDebug(message: string)` + +Logs the given message at the `Debug` log level. + +### LogDebugf + +Go Signature: `LogDebugf(ctx context.Context, format string, args ...interface{})` + +Logs the given message at the `Debug` log level. + +### LogInfo + +Go Signature: `LogInfo(ctx context.Context, message string)` + +JS Signature: `LogInfo(message: string)` + +Logs the given message at the `Info` log level. + +### LogInfof + +Go Signature: `LogInfof(ctx context.Context, format string, args ...interface{})` + +Logs the given message at the `Info` log level. + +### LogWarning + +Go Signature: `LogWarning(ctx context.Context, message string)` + +JS Signature: `LogWarning(message: string)` + +Logs the given message at the `Warning` log level. + +### LogWarningf + +Go Signature: `LogWarningf(ctx context.Context, format string, args ...interface{})` + +Logs the given message at the `Warning` log level. + +### LogError + +Go Signature: `LogError(ctx context.Context, message string)` + +JS Signature: `LogError(message: string)` + +Logs the given message at the `Error` log level. + +### LogErrorf + +Go Signature: `LogErrorf(ctx context.Context, format string, args ...interface{})` + +Logs the given message at the `Error` log level. + +### LogFatal + +Go Signature: `LogFatal(ctx context.Context, message string)` + +JS Signature: `LogFatal(message: string)` + +Logs the given message at the `Fatal` log level. + +### LogFatalf + +Go Signature: `LogFatalf(ctx context.Context, format string, args ...interface{})` + +Logs the given message at the `Fatal` log level. + +### LogSetLogLevel + +Go Signature: `LogSetLogLevel(ctx context.Context, level logger.LogLevel)` + +JS Signature: `LogSetLogLevel(level: number)` + +Sets the log level. In Javascript, the number relates to the following log levels: + +| Value | Log Level | +| ----- | --------- | +| 1 | Trace | +| 2 | Debug | +| 3 | Info | +| 4 | Warning | +| 5 | Error | + +## Using a Custom Logger + +A custom logger may be used by providing it using the [Logger](../options.mdx#logger) application option. The only requirement is that the logger implements the `logger.Logger` interface defined in `github.com/wailsapp/wails/v2/pkg/logger`: + +```go title="logger.go" +type Logger interface { + Print(message string) + Trace(message string) + Debug(message string) + Info(message string) + Warning(message string) + Error(message string) + Fatal(message string) +} +``` + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/menu.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/menu.mdx new file mode 100644 index 000000000..7d2d01783 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/menu.mdx @@ -0,0 +1,25 @@ +--- +sidebar_position: 6 +--- + +# Menu + +## Overview + +These methods are related to the application menu. + +:::info Javascript + Menu is currently unsupported in the JS runtime. +::: + +### MenuSetApplicationMenu +Go Signature: `MenuSetApplicationMenu(ctx context.Context, menu *menu.Menu)` + +Sets the application menu to the given [menu](../menus.mdx) . + +### MenuUpdateApplicationMenu +Go Signature: `MenuUpdateApplicationMenu(ctx context.Context)` + +Updates the application menu, picking up any changes to the menu passed to `MenuSetApplicationMenu`. + + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/window.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/window.mdx new file mode 100644 index 000000000..f279a6eba --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/reference/runtime/window.mdx @@ -0,0 +1,220 @@ +--- +sidebar_position: 4 +--- + +# Window + +## Overview + +These methods give control of the application window. + +### WindowSetTitle +Go Signature: `WindowSetTitle(ctx context.Context, title string)` + +JS Signature: `WindowSetTitle(title: string)` + +Sets the text in the window title bar. + +### WindowFullscreen +Go Signature: `WindowFullscreen(ctx context.Context)` + +JS Signature: `WindowFullscreen()` + +Makes the window full screen. + +### WindowUnfullscreen +Go Signature: `WindowUnfullscreen(ctx context.Context)` + +JS Signature: `WindowUnfullscreen()` + +Restores the previous window dimensions and position prior to full screen. + +### WindowCenter +Go Signature: `WindowCenter(ctx context.Context)` + +JS Signature: `WindowCenter()` + +Centers the window on the monitor the window is currently on. + +### WindowReload +Go Signature: `WindowReload(ctx context.Context)` + +JS Signature: `WindowReload()` + +Performs a "reload" (Reloads current page). + +### WindowReloadApp +Go Signature: `WindowReloadApp(ctx context.Context)` + +JS Signature: `WindowReloadApp()` + +Reloads the application frontend. + +### WindowSetSy + +### WindowSetSystemDefaultTheme +Go Signature: `WindowSetSystemDefaultTheme(ctx context.Context)` + +JS Signature: `WindowSetSystemDefaultTheme()` + +Windows only. + +Sets window theme to system default (dark/light). + +### WindowSetLightTheme +Go Signature: `WindowSetLightTheme(ctx context.Context)` + +JS Signature: `WindowSetLightTheme()` + +Windows only. + +Sets window theme to light. + +### WindowSetDarkTheme +Go Signature: `WindowSetDarkTheme(ctx context.Context)` + +JS Signature: `WindowSetDarkTheme()` + +Windows only. + +Sets window theme to dark. + +### WindowShow +Go Signature: `WindowShow(ctx context.Context)` + +JS Signature: `WindowShow()` + +Shows the window, if it is currently hidden. + +### WindowHide +Go Signature: `WindowHide(ctx context.Context)` + +JS Signature: `WindowHide()` + +Hides the window, if it is currently visible. + +### WindowSetSize +Go Signature: `WindowSetSize(ctx context.Context, width int, height int)` + +JS Signature: `WindowSetSize(size: Size)` + +Sets the width and height of the window. + +### WindowGetSize +Go Signature: `WindowGetSize(ctx context.Context) (width int, height int)` + +JS Signature: `WindowGetSize() : Size` + +Gets the width and height of the window. + +### WindowSetMinSize +Go Signature: `WindowSetMinSize(ctx context.Context, width int, height int)` + +JS Signature: `WindowSetMinSize(size: Size)` + +Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions. + +Setting a size of `0,0` will disable this constraint. + +### WindowSetMaxSize +Go Signature: `WindowSetMaxSize(ctx context.Context, width int, height int)` + +JS Signature: `WindowSetMaxSize(size: Size)` + +Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions. + +Setting a size of `0,0` will disable this constraint. + +### WindowSetAlwaysOnTop +Go Signature: `WindowSetAlwaysOnTop(ctx context.Context, b bool)` + +JS Signature: `WindowSetAlwaysOnTop(b: Boolen)` + +Sets the window AlwaysOnTop or not on top. + + +### WindowSetPosition +Go Signature: `WindowSetPosition(ctx context.Context, x int, y int)` + +JS Signature: `WindowSetPosition(position: Position)` + +Sets the window position relative to the monitor the window is currently on. + +### WindowGetPosition +Go Signature: `WindowGetPosition(ctx context.Context) (x int, y int)` + +JS Signature: `WindowGetPosition() : Position` + +Gets the window position relative to the monitor the window is currently on. + +### WindowMaximise +Go Signature: `WindowMaximise(ctx context.Context)` + +JS Signature: `WindowMaximise()` + +Maximises the window to fill the screen. + +### WindowUnmaximise +Go Signature: `WindowUnmaximise(ctx context.Context)` + +JS Signature: `WindowUnmaximise()` + +Restores the window to the dimensions and position prior to maximising. + +### WindowToggleMaximise +Go Signature: `WindowToggleMaximise(ctx context.Context)` + +JS Signature: `WindowToggleMaximise()` + +Toggles between Maximised and UnMaximised. + +### WindowMinimise +Go Signature: `WindowMinimise(ctx context.Context)` + +JS Signature: `WindowMinimise()` + +Minimises the window. + +### WindowUnminimise +Go Signature: `WindowUnminimise(ctx context.Context)` + +JS Signature: `WindowUnminimise()` + +Restores the window to the dimensions and position prior to minimising. + +### WindowSetBackgroundColour +Go Signature: `WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)` + +JS Signature: `WindowSetBackgroundColour(R, G, B, A)` + +Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels. + +Valid values for R, G, B and A are 0-255. + +:::info Windows + +On Windows, only alpha values of 0 or 255 are supported. Any value that is not 0 will be considered 255. + +::: + +## Typescript Object Definitions + +### Position + +```ts +interface Position { + x: number; + y: number; +} +``` + +### Size + +```ts +interface Size { + w: number; + h: number; +} +``` + + diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/tutorials/_category_.json b/website/i18n/ru/docusaurus-plugin-content-docs/current/tutorials/_category_.json new file mode 100644 index 000000000..dfac1d175 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/tutorials/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Tutorials", + "position": 70 +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/tutorials/helloworld.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/tutorials/helloworld.mdx new file mode 100644 index 000000000..2a1246343 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/tutorials/helloworld.mdx @@ -0,0 +1,112 @@ +--- +sidebar_position: 10 +--- + +# Hello World + +The aim of this tutorial is to get you up and running with the most basic application using Wails. You will be able to: + + - Create a new Wails application + - Build the application + - Run the application + +:::note +This tutorial uses Windows as the target platform. Output will vary slightly +depending on your operating system. +::: + +## Create a new Wails application + +To create a new Wails application using the default vanilla JS template, you need to run the following command: + +```bash +wails init -n helloworld +``` + +You should see something similar to the following: + +``` +Wails CLI v2.0.0 + +Initialising Project 'helloworld' +--------------------------------- + +Project Name: helloworld +Project Directory: C:\Users\leaan\tutorial\helloworld +Project Template: vanilla +Template Support: https://wails.io + +Initialised project 'helloworld' in 232ms. +``` + +This will create a new directory called `helloworld` in the current directory. In this directory, you will find a number of files: + +``` +build/ - Contains the build files + compiled application +frontend/ - Contains the frontend files +app.go - Contains the application code +main.go - The main program with the application configuration +wails.json - The project configuration file +go.mod - The go module file +go.sum - The go module checksum file +``` + +## Build the application + +To build the application, change to the new `helloworld` project directory and run the following command: + +```bash +wails build +``` + +You should see something like the following: + +``` +Wails CLI v2.0.0 + +App Type: desktop +Platforms: windows/amd64 +Compiler: C:\Users\leaan\go\go1.18.3\bin\go.exe +Build Mode: Production +Skip Frontend: false +Compress: false +Package: true +Clean Build Dir: false +LDFlags: "" +Tags: [] +Race Detector: false + +Building target: windows/amd64 +------------------------------ + - Installing frontend dependencies: Done. + - Compiling frontend: Done. + - Generating bundle assets: Done. + - Compiling application: Done. +Built 'C:\Users\leaan\tutorial\helloworld\build\bin\helloworld.exe' in 10.616s. +``` + +This has compiled the application and saved it in the `build/bin` directory. + +## Run the application + +If we view the `build/bin` directory in Windows Explorer, we should see our project binary: + +
+ +
+ +
+ +We can run it by simply double-clicking the `helloworld.exe` file. + +On Mac, Wails generates a `helloworld.app` file which can be run by double-clicking it. + +On Linux, you can run the application using `./helloworld` from the `build/bin` directory. + +You should see the application working as expected: + +
+ >255 / 20%) 0px 1px 2px 0px, rgb(104 104 104) 0px 1px 5px 0px"}}/> +
+
diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/version-v2.0.0-beta.38.json b/website/i18n/ru/docusaurus-plugin-content-docs/version-v2.0.0-beta.38.json new file mode 100644 index 000000000..c195ee101 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/version-v2.0.0-beta.38.json @@ -0,0 +1,30 @@ +{ + "version.label": { + "message": "v2.0.0-beta.38", + "description": "The label for version v2.0.0-beta.38" + }, + "sidebar.tutorialSidebar.category.Getting Started": { + "message": "Getting Started", + "description": "The label for category Getting Started in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Reference": { + "message": "Reference", + "description": "The label for category Reference in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Runtime": { + "message": "Runtime", + "description": "The label for category Runtime in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Community": { + "message": "Community", + "description": "The label for category Community in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Showcase": { + "message": "Showcase", + "description": "The label for category Showcase in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar tutorialSidebar" + } +} diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/version-v2.0.0-beta.39.json b/website/i18n/ru/docusaurus-plugin-content-docs/version-v2.0.0-beta.39.json new file mode 100644 index 000000000..50826a275 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-docs/version-v2.0.0-beta.39.json @@ -0,0 +1,38 @@ +{ + "version.label": { + "message": "v2.0.0-beta.39", + "description": "The label for version v2.0.0-beta.39" + }, + "sidebar.tutorialSidebar.category.Getting Started": { + "message": "Getting Started", + "description": "The label for category Getting Started in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Reference": { + "message": "Reference", + "description": "The label for category Reference in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Runtime": { + "message": "Runtime", + "description": "The label for category Runtime in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Community": { + "message": "Community", + "description": "The label for category Community in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Showcase": { + "message": "Showcase", + "description": "The label for category Showcase in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Tutorials": { + "message": "Tutorials", + "description": "The label for category Tutorials in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Contributing": { + "message": "Contributing", + "description": "The label for category Contributing in sidebar tutorialSidebar" + } +} diff --git a/website/i18n/ru/docusaurus-plugin-content-pages/changelog.md b/website/i18n/ru/docusaurus-plugin-content-pages/changelog.md new file mode 100644 index 000000000..7141364c4 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-pages/changelog.md @@ -0,0 +1,334 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased][] + +## [v2.0.0-beta.43] - 2022-08-08 + +## Added + +* Add support for retrieving the release notes from Github by @leaanthony in https://github.com/wailsapp/wails/pull/1679 +* Add `frontend:dev:install` configuration by @LGiki in https://github.com/wailsapp/wails/pull/1666 + +## Fixed + +* Fix formatting of some error messages by @stffabi in https://github.com/wailsapp/wails/pull/1665 +* Windows dialogs now work when window is not visible yet by @leaanthony in https://github.com/wailsapp/wails/pull/1662 +* Multiple fixes for MacOS asset requests by @stffabi in https://github.com/wailsapp/wails/pull/1668 and https://github.com/wailsapp/wails/pull/1681 +* Fix for Go 1.19 by @stffabi in https://github.com/wailsapp/wails/pull/1689 +* Removed Linux warnings by @leaanthony in https://github.com/wailsapp/wails/pull/1656 +* Better support for doubleclick events in drag regions by @leaanthony in https://github.com/wailsapp/wails/pull/1704 +* Allow MacOS frameless window to be miniturisable by @leaanthony in https://github.com/wailsapp/wails/pull/1705 + +## What's Changed + +* add wails-sveltekit-template by @h8gi in https://github.com/wailsapp/wails/pull/1671 +* wails doctor now reports correct MacOS os id by @stffabi in https://github.com/wailsapp/wails/pull/1673 +* Update application-development.mdx by @SamHennessy in https://github.com/wailsapp/wails/pull/1682 +* Move SetMin/Max calls to main thread by @leaanthony in https://github.com/wailsapp/wails/pull/1684 +* Change `frontend:dev` to `frontend:dev:build` by @LGiki in https://github.com/wailsapp/wails/pull/1691 +* Build frontend only before starting the dev watcher command by @stffabi in https://github.com/wailsapp/wails/pull/1694 +* Improve error message for auto dev server discovery without a dev watcher by @stffabi in https://github.com/wailsapp/wails/pull/1711 + +## New Contributors + +* @h8gi made their first contribution in https://github.com/wailsapp/wails/pull/1671 +* @SamHennessy made their first contribution in https://github.com/wailsapp/wails/pull/1682 + +## [v2.0.0-beta.42] - 2022-07-25 + +## Added + +* Added `options.NewRGBA` and `options.NewRGB` functions to create `*options.RGBA` by @leaanthony + +## Fixed + +* Fixed initial build of frontend when using `wails dev` on new projects by @leaanthony in https://github.com/wailsapp/wails/pull/1650 +* Ignore empty install command when running `wails dev` by @stffabi in https://github.com/wailsapp/wails/pull/1651 +* Fixed error reporting in templates +* BackgroundColour documentation fix +* Generalize manual compile steps [Documentation] by @acheong08 in https://github.com/wailsapp/wails/pull/1644 + +## [v2.0.0-beta.40] - 2022-07-24 + +## Added + +* Add Show() and Hide() to runtime to show/hide application by @leaanthony in https://github.com/wailsapp/wails/pull/1599 +* Override target platform/arch using GOOS and GOARCH environment variables by @leaanthony in https://github.com/wailsapp/wails/pull/1618 +* Add option to skip frontend rebuild in dev mode by @leaanthony in https://github.com/wailsapp/wails/pull/1632 + +## Fixed + +* Update svelte templates to use vite 3 by @leaanthony in https://github.com/wailsapp/wails/pull/1643 +* Fix plain template by @stffabi in https://github.com/wailsapp/wails/pull/1609 +* Fix Website layout by @leaanthony in https://github.com/wailsapp/wails/pull/1616 +* Fixed typo in documentation page docs/howdoesitwork by @MyNameIsAres in https://github.com/wailsapp/wails/pull/1636 +* Use scaling when setting min/max window by @leaanthony in https://github.com/wailsapp/wails/pull/1557 + +## Changed + +* Install dev dependencies before starting dev mode by @leaanthony in https://github.com/wailsapp/wails/pull/1615 +* Translate and fix website text by @misitebao in https://github.com/wailsapp/wails/pull/1525 +* docs: add MyNameIsAres as a contributor for doc by @allcontributors in https://github.com/wailsapp/wails/pull/1638 +* Deprecate Fullscreen appoption by @acheong08 in https://github.com/wailsapp/wails/pull/1640 + +## Deprecated + +* The `Fullscreen` application option is deprecated. Please use [`WindowStartState`](https://wails.io/docs/reference/options#windowstartstate) instead. +## New Contributors + +* @MyNameIsAres made their first contribution in https://github.com/wailsapp/wails/pull/1636 + +## [v2.0.0-beta.39.2] - 2022-07-20 + +## Added + +* Update example for macOS Menu by @acheong08 in https://github.com/wailsapp/wails/pull/1600 + +## Fixed + +* Reinstate Go 1.17 compatibility by @leaanthony in https://github.com/wailsapp/wails/pull/1605 + +## [v2.0.0-beta.39] - 2022-07-19 + +## Added + +* New screen dimensions runtime API by @skamensky in https://github.com/wailsapp/wails/pull/1519 +* Auto discover vite devserver port by @leaanthony in https://github.com/wailsapp/wails/pull/1547 +* Add nixpkgs support to doctor command. by @ianmjones in https://github.com/wailsapp/wails/pull/1551 +* New pre-build hooks feature by @leaanthony in https://github.com/wailsapp/wails/pull/1578 +* New production log level option by @leaanthony in https://github.com/wailsapp/wails/pull/1555 + +## Fixed + +* Fix stack corruption in Windows when using ICoreWebView2HttpHeadersCollectionIterator by @stffabi in https://github.com/wailsapp/wails/pull/1589 +* Move WindowGet* to main thread by @leaanthony in https://github.com/wailsapp/wails/pull/1464 +* Allow -appargs flag to pass flags to binary. by @ianmjones in https://github.com/wailsapp/wails/pull/1534 +* Fix checking for installed apt package in none English session. by @ianmjones in https://github.com/wailsapp/wails/pull/1548 +* Fix OnBeforeClose code for Mac by @leaanthony in https://github.com/wailsapp/wails/pull/1558 +* Support Maps in TS conversion by @leaanthony in https://github.com/wailsapp/wails/pull/1435 +* Check for line length when scanning for local devserver url by @leaanthony in https://github.com/wailsapp/wails/pull/1566 +* Remove usage of unsafe.Pointer in winc by @stffabi and @leaanthony in https://github.com/wailsapp/wails/pull/1556 + +## Changed + +* Rename WindowSetRGBA -> WindowSetBackgroundColour by @leaanthony in https://github.com/wailsapp/wails/pull/1506 +* Improvements to the dev command by @stffabi in https://github.com/wailsapp/wails/pull/1510 +* Update vscode template by @leaanthony in https://github.com/wailsapp/wails/pull/1398 +* Bump svelte from 3.42.2 to 3.49.0 in /v2/internal/frontend/runtime/dev by @dependabot in https://github.com/wailsapp/wails/pull/1572 +* Bump svelte from 3.42.5 to 3.49.0 in /v2/internal/frontend/runtime by @dependabot in https://github.com/wailsapp/wails/pull/1573 +* Add troubleshooting for `Not Found` error by @acheong08 in https://github.com/wailsapp/wails/pull/1586 +* Docs/better homepage by @leaanthony in https://github.com/wailsapp/wails/pull/1591 + +## New Contributors + +* @skamensky made their first contribution in https://github.com/wailsapp/wails/pull/1519 +* @acheong08 made their first contribution in https://github.com/wailsapp/wails/pull/1586 + +**Full Changelog**: https://github.com/wailsapp/wails/compare/v2.0.0-beta.38...v2.0.0-beta.39 + +## [v2.0.0-beta.38] - 2022-06-27 + +### Added + +* Add race detector to build & dev by @Lyimmi in https://github.com/wailsapp/wails/pull/1426 +* [linux] Support `linux/arm` architecture by @Lyimmi in https://github.com/wailsapp/wails/pull/1427 +* Create gitignore when using `-g` option by @jaesung9507 in https://github.com/wailsapp/wails/pull/1430 +* [windows] Add Suspend/Resume callback support by @leaanthony in https://github.com/wailsapp/wails/pull/1474 +* Add runtime function `WindowSetAlwaysOnTop` by @chenxiao1990 in https://github.com/wailsapp/wails/pull/1442 +* [windows] Allow setting browser path by @NanoNik in https://github.com/wailsapp/wails/pull/1448 + +### Fixed + +* [linux] Improve switching to main thread for callbacks by @stffabi in https://github.com/wailsapp/wails/pull/1392 +* [windows] Fix WebView2 minimum runtime version check by @stffabi in https://github.com/wailsapp/wails/pull/1456 +* [linux] Fix apt command syntax (#1458) by @abtin in https://github.com/wailsapp/wails/pull/1461 +* [windows] Set Window Background colour if provided + debounce redraw option by @leaanthony in https://github.com/wailsapp/wails/pull/1466 +* Fix small typo in docs by @LukenSkyne in https://github.com/wailsapp/wails/pull/1449 +* Fix the url to surge by @andywenk in https://github.com/wailsapp/wails/pull/1460 +* Fixed theme change at runtime by @leaanthony in https://github.com/wailsapp/wails/pull/1473 +* Fix: Don't stop if unable to remove temporary bindings build by @leaanthony in https://github.com/wailsapp/wails/pull/1465 +* [windows] Pass the correct installationStatus to the webview installation strategy by @stffabi in https://github.com/wailsapp/wails/pull/1483 +* [windows] Make `SetBackgroundColour` compatible for `windows/386` by @stffabi in https://github.com/wailsapp/wails/pull/1493 +* Fix lit-ts template by @Orijhins in https://github.com/wailsapp/wails/pull/1494 + +### Changed + +* [windows] Load WebView2 loader from embedded only by @stffabi in https://github.com/wailsapp/wails/pull/1432 +* Add showcase entry for October + update homepage carousel entry for October by @marcus-crane in https://github.com/wailsapp/wails/pull/1436 +* Always use return in wrapped method by @leaanthony in https://github.com/wailsapp/wails/pull/1410 +* [windows] Unlock OSThread after native calls have been finished by @stffabi in https://github.com/wailsapp/wails/pull/1441 +* Add `BackgroundColour` and deprecate `RGBA` by @leaanthony in https://github.com/wailsapp/wails/pull/1475 +* AssetsHandler remove retry logic in dev mode by @stffabi in https://github.com/wailsapp/wails/pull/1479 +* Add Solid JS template to docs by @sidwebworks in https://github.com/wailsapp/wails/pull/1492 +* Better signal handling by @leaanthony in https://github.com/wailsapp/wails/pull/1488 +* Chore/react 18 create root by @tomanagle in https://github.com/wailsapp/wails/pull/1489 + +## New Contributors + +* @jaesung9507 made their first contribution in https://github.com/wailsapp/wails/pull/1430 +* @LukenSkyne made their first contribution in https://github.com/wailsapp/wails/pull/1449 +* @andywenk made their first contribution in https://github.com/wailsapp/wails/pull/1460 +* @abtin made their first contribution in https://github.com/wailsapp/wails/pull/1461 +* @chenxiao1990 made their first contribution in https://github.com/wailsapp/wails/pull/1442 +* @NanoNik made their first contribution in https://github.com/wailsapp/wails/pull/1448 +* @sidwebworks made their first contribution in https://github.com/wailsapp/wails/pull/1492 +* @tomanagle made their first contribution in https://github.com/wailsapp/wails/pull/1489 + +## [v2.0.0-beta.37] - 2022-05-26 + +### Added + +* Add `nogen` flag in wails dev command by @mondy in https://github.com/wailsapp/wails/pull/1413 +* Initial support for new native translucency in Windows Preview by @leaanthony in https://github.com/wailsapp/wails/pull/1400 + +### Fixed + +* Bugfix/incorrect bindings by @leaanthony in https://github.com/wailsapp/wails/pull/1383 +* Fix runtime.js events by @polikow in https://github.com/wailsapp/wails/pull/1369 +* Fix docs formatting by @antimatter96 in https://github.com/wailsapp/wails/pull/1372 +* Events | fixes #1388 by @lambdajack in https://github.com/wailsapp/wails/pull/1390 +* bugfix: correct typo by @tmclane in https://github.com/wailsapp/wails/pull/1391 +* Fix typo in docs by @LGiki in https://github.com/wailsapp/wails/pull/1393 +* Fix typo bindings.js to ipc.js by @rayshoo in https://github.com/wailsapp/wails/pull/1406 +* Make sure to execute the menu callbacks on a new goroutine by @stffabi in https://github.com/wailsapp/wails/pull/1403 +* Update runtime.d.ts & templates by @Yz4230 in https://github.com/wailsapp/wails/pull/1421 +* Add missing className to input in React and Preact templates by @edwardbrowncross in https://github.com/wailsapp/wails/pull/1419 + +### Changed +* Improve multi-platform builds by @stffabi in https://github.com/wailsapp/wails/pull/1373 +* During wails dev only use reload logic if no AssetsHandler are in use by @stffabi in https://github.com/wailsapp/wails/pull/1385 +* Update events.mdx by @Junkher in https://github.com/wailsapp/wails/pull/1387 +* Add Next.js template by @LGiki in https://github.com/wailsapp/wails/pull/1394 +* Add docs on wails generate module by @TechplexEngineer in https://github.com/wailsapp/wails/pull/1414 +* Add macos custom menu EditMenu tips by @daodao97 in https://github.com/wailsapp/wails/pull/1423 + +### New Contributors +* @polikow made their first contribution in https://github.com/wailsapp/wails/pull/1369 +* @antimatter96 made their first contribution in https://github.com/wailsapp/wails/pull/1372 +* @Junkher made their first contribution in https://github.com/wailsapp/wails/pull/1387 +* @lambdajack made their first contribution in https://github.com/wailsapp/wails/pull/1390 +* @LGiki made their first contribution in https://github.com/wailsapp/wails/pull/1393 +* @rayshoo made their first contribution in https://github.com/wailsapp/wails/pull/1406 +* @TechplexEngineer made their first contribution in https://github.com/wailsapp/wails/pull/1414 +* @mondy made their first contribution in https://github.com/wailsapp/wails/pull/1413 +* @Yz4230 made their first contribution in https://github.com/wailsapp/wails/pull/1421 +* @daodao97 made their first contribution in https://github.com/wailsapp/wails/pull/1423 +* @edwardbrowncross made their first contribution in https://github.com/wailsapp/wails/pull/1419 + + +## [v2.0.0-beta.36] - 2022-04-27 + +### Fixed +- [v2] Validate devServer property to be of the correct form by [@stffabi](https://github.com/stffabi) in https://github.com/wailsapp/wails/pull/1359 +- [v2, darwin] Initialize native variables on stack to prevent segfault by [@stffabi](https://github.com/stffabi) in https://github.com/wailsapp/wails/pull/1362 +- Vue-TS template fix + +### Changed +- Added `OnStartup` method back to default templates + +## [v2.0.0-beta.35] - 2022-04-27 + +### Breaking Changes + +- When data was sent to the `EventsOn` callback, it was being sent as a slice of values, instead of optional parameters to the method. `EventsOn` now works as expected, but you will need to update your code if you currently use this. [More information](https://github.com/wailsapp/wails/issues/1324) +- The broken `bindings.js` and `bindings.d.ts` files have been replaced by a new JS/TS code generation system. More details [here](https://wails.io/docs/howdoesitwork#calling-bound-go-methods) + +### Added + +- **New Templates**: Svelte, React, Vue, Preact, Lit and Vanilla templates, both JS and TS versions. `wails init -l` for more info. +- Default templates now powered by [Vite](https://vitejs.dev). This enables lightning fast reloads when you use `wails dev`! +- Add support for external frontend development servers. See `frontend:dev:serverUrl` in the [project config](https://wails.io/docs/reference/project-config) - [@stffabi](https://github.com/stffabi) +- [Fully configurable dark mode](https://wails.io/docs/reference/options#theme) for Windows. +- Hugely improved [WailsJS generation](https://wails.io/docs/howdoesitwork#calling-bound-go-methods) (both Javascript and Typescript) +- Wails doctor now reports information about the wails installation - [@stffabi](https://github.com/stffabi) +- Added docs for [code-signing](https://wails.io/docs/guides/signing) and [NSIS installer](https://wails.io/docs/guides/windows-installer) - [@gardc](https://github.com/gardc) +- Add support for `-trimpath` [build flag](https://wails.io/docs/reference/cli#build) +- Add support for a default AssetsHandler - [@stffabi](https://github.com/stffabi) + +### Fixed + +- Improved mimetype detection for BOM marker and comments - [@napalu](https://github.com/napalu) +- Remove duplicate mimetype entries - [@napalu](https://github.com/napalu) +- Remove duplicate Typescript imports in generated definition files - [@adalessa](https://github.com/adalessa) +- Add missing method declaration - [@adalessa](https://github.com/adalessa) +- Fix Linux sigabrt on start - [@napalu](https://github.com/napalu) +- Double Click event now works on elements with `data-wails-drag` attribute - [@jicg](https://github.com/jicg) +- Suppress resizing during minimize of a frameless window - [@stffabi](https://github.com/stffabi) +- Fixed TS/JS generation for Go methods with no returns +- Fixed WailsJS being generated in project directory + +### Changed + +- Website docs are now versioned +- Improved `runtime.Environment` call +- Improve the close action for Mac +- A bunch of dependabot security updates +- Improved website content - [@misitebao](https://github.com/misitebao) +- Upgrade issue template - [@misitebao](https://github.com/misitebao) +- Convert documents that don't require version management to individual pages + - [@misitebao](https://github.com/misitebao) +- Website now using Algolia search + +## [v2.0.0-beta.34] - 2022-03-26 + +### Added + +- Add support for 'DomReady' callback on linux by [@napalu](https://github.com/napalu) in #1249 +- MacOS - Show extension by default by [@leaanthony](https://github.com/leaanthony) in #1228 + +### Fixed + +- [v2, nsis] Seems like / as path separator works only for some directives in a cross platform way by [@stffabi](https://github.com/stffabi) in #1227 +- import models on binding definition by [@adalessa](https://github.com/adalessa) in #1231 +- Use local search on website by [@leaanthony](https://github.com/leaanthony) in #1234 +- Ensure binary resources can be served by [@napalu](https://github.com/napalu) in #1240 +- Only retry loading assets when loading from disk by [@leaanthony](https://github.com/leaanthony) in #1241 +- [v2, windows] Fix maximised start state by [@stffabi](https://github.com/stffabi) in #1243 +- Ensure Linux IsFullScreen uses GDK_WINDOW_STATE_FULLSCREEN bitmask appropriately. by [@ianmjones](https://github.com/ianmjones) in #1245 +- Fix memory leak in ExecJS for Mac by [@leaanthony](https://github.com/leaanthony) in #1230 +- Fix, or at least a workaround, for (#1232) by [@BillBuilt](https://github.com/BillBuilt) in #1247 +- [v2] Use os.Args[0] for self starting wails by [@stffabi](https://github.com/stffabi) in #1258 +- [v2, windows] Windows switch scheme: https -> http by @stefpap in #1255 +- Ensure Focus is regained by Webview2 when tabbing by [@leaanthony](https://github.com/leaanthony) in #1257 +- Try to focus window when Show() is called. by [@leaanthony](https://github.com/leaanthony) in #1212 +- Check system for user installed Linux dependencies by [@leaanthony](https://github.com/leaanthony) in #1180 + +### Changed + +- feat(website): sync documents and add content by [@misitebao](https://github.com/misitebao) in #1215 +- refactor(cli): optimize default templates by [@misitebao](https://github.com/misitebao) in #1214 +- Run watcher after initial build by [@leaanthony](https://github.com/leaanthony) in #1216 +- Feature/docs update by [@leaanthony](https://github.com/leaanthony) in #1218 +- feat(website): optimize website and sync documents by [@misitebao](https://github.com/misitebao) in #1219 +- docs: sync documents by [@misitebao](https://github.com/misitebao) in #1224 +- Default index page by [@leaanthony](https://github.com/leaanthony) in #1229 +- Build added win32 compatibility by [@fengweiqiang](https://github.com/fengweiqiang) in #1238 +- docs: sync documents by [@misitebao](https://github.com/misitebao) in #1260 + +## [v2.0.0-beta.33][] - 2022-03-05 + +### Added + +- NSIS Installer support for creating installers for Windows applications - Thanks [@stffabi](https://github.com/stffabi) 🎉 +- New frontend:dev:watcher command to spin out 3rd party watchers when using wails dev - Thanks [@stffabi](https://github.com/stffabi)🎉 +- Remote templates now support version tags - Thanks [@misitebao](https://github.com/misitebao) 🎉 + +### Fixed + +- A number of fixes for ARM Linux providing a huge improvement - Thanks [@ianmjones](https://github.com/ianmjones) 🎉 +- Fixed potential Nil reference when discovering the path to `index.html` +- Fixed crash when using `runtime.Log` methods in a production build +- Improvements to internal file handling meaning webworkers will now work on Windows - Thanks [@stffabi](https://github.com/stffabi)🎉 + +### Changed + +- The Webview2 bootstrapper is now run as a normal user and doesn't require admin rights +- The docs have been improved and updated +- Added troubleshooting guide + +[Unreleased]: https://github.com/wailsapp/wails/compare/v2.0.0-beta.33...HEAD +[v2.0.0-beta.33]: https://github.com/wailsapp/wails/compare/v2.0.0-beta.32...v2.0.0-beta.33 diff --git a/website/i18n/ru/docusaurus-plugin-content-pages/community-guide.md b/website/i18n/ru/docusaurus-plugin-content-pages/community-guide.md new file mode 100644 index 000000000..686c10393 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-pages/community-guide.md @@ -0,0 +1,3 @@ +# Community Guide + +The number of Wails users is growing at an incredible rate, and if you're reading this, chances are you're ready to join. So... welcome! diff --git a/website/i18n/ru/docusaurus-plugin-content-pages/credits.mdx b/website/i18n/ru/docusaurus-plugin-content-pages/credits.mdx new file mode 100644 index 000000000..63af0a447 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-pages/credits.mdx @@ -0,0 +1,300 @@ +# Credits + +- [Lea Anthony](https://github.com/leaanthony) - Project owner, lead developer +- [Stffabi](https://github.com/stffabi) - Technical lead, developer and maintainer +- [Misitebao](https://github.com/misitebao) - Documentation wizard, Chinese translation, Windows testing, Bug finder general +- [Travis McLane](https://github.com/tmclane) - Cross-compilation work, MacOS testing +- [Byron Chris](https://github.com/bh90210) - Linux distro wizard, Linux testing + +## Sponsors +
+ + + + + + +
+
+ + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +directory + + + + + + + + + + + + + + + + + + + + + + + + +`, }} /> + +## Contributors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Lea Anthony

💻 🤔 🎨 🖋 💡 🧑‍🏫 📆 🔧 🐛 📝 🚧 📦 👀 💬 🔬 ⚠️ 📢 👀 📖

stffabi

💻 🤔 🎨 🐛 🚧 📦 👀 💬 🔬 👀 📖 ⚠️

Travis McLane

💻 🔬 📦 🤔 🐛 👀 ⚠️ 💬 📖

Misite Bao

📖 🌍 🔬 🚧

Byron Chris

💻 🔬 🚧 🐛 👀 ⚠️ 💬 🤔 🎨 📦 🚇

konez2k

💻 📦 🤔

Dario Emerson

💻 🐛 🤔 ⚠️

Ian M. Jones

💻 🐛 🤔 ⚠️ 👀 📦

marktohark

💻

Ryan H

💻

Cody Bentley

💻 📦 🤔 💵

Florent

💻 🐛

Alexander Hudek

💻 💵

Tim Kipp

💻

Altynbek Kaliakbarov

💻

Nikolai Zimmermann

💻

k-muchmore

💻

Snider

💻 🤔 📖 💵

Albert Sun

💻 ⚠️

Ariel

💻 🐛

Ilgıt Yıldırım

💻 🐛 💵

Toyam Cox

💻 📦 🐛

hi019

💻 🐛

Arthur Wiebe

💻 🐛

Balakrishna Prasad Ganne

💻

BillBuilt

💻 📦 🤔 💬 💵

Eng Zer Jun

🚧 💻

LGiki

📖

Lontten

📖

Lukas Crepaz

💻 🐛

Marcus Crane

🐛 📖 💵

Qais Patankar

📖

Wakeful-Cloud

💻 🐛

Zámbó, Levente

💻 📦 🐛 ⚠️

Ironpark

💻 🤔

mondy

💻 📖

Benjamin Ryan

🐛

fallendusk

📦 💻

Mat Ryer

💻 🤔 🐛

Abtin

💻 🐛

Adrian Lanzafame

📦 💻

Aleksey Polyakov

🐛 💻

Alexander Matviychuk

💻 📦

AlienRecall

💻 📦

Aman

📖

Amaury Tobias Quiroz

💻 🐛

Andreas Wenk

📖

Antonio Stanković

💻 📦

Arpit Jain

📖

Austin Schey

💻 🐛

Benjamin Thomas

💻 📦 🤔

Bertram Truong

💻 🐛

Blake Bourque

📖

Denis

📖

diogox

💻 📦

Dmitry Gomzyakov

💻 📦

Edward Browncross

💻

Elie Grenon

💻

Florian Didron

💻 🐛 🤔 ⚠️ 👀 📦

GargantuaX

📖 💵

Igor Minin

💻 🐛

Jae-Sung Lee

💻 🤔

Jarek

💻 📦

Junker

📖

Kris Raney

💻 🐛

Luken

📖

Mark Stenglein

💻 🐛

buddyabaddon

💻

MikeSchaap

💻 🐛

NYSSEN Michaël

💻 🐛

Nan0

💻 🤔 ⚠️ 👀

oskar

📖

Pierre Joye

💻 🐛 🤔 ⚠️

Reuben Thomas-Davis

💻 🐛

Robin

💻 🐛

Sebastian Bauer

💻 🤔 ⚠️ 👀 💬

Sidharth Rathi

📖 🐛

Sithembiso Khumalo

💻 🐛

Soheib El-Harrache

💻 🐛 💵

Sophie Au

💻 🐛

Stefanos Papadakis

💻 🐛

Steve Chung

💻 🐛

Timm Ortloff

📖

Tom

💻

Valentin Trinqué

💻 🐛

mattn

💻 🐛

bearsh

💻 🤔 📖

chenxiao

💻 🤔 📖

fengweiqiang

💻 📦

flin7

📖

fred21O4

📖

gardc

📖

rayshoo

📖

Ishiyama Yuzuki

💻 🐛

佰阅

💻

刀刀

📖 🐛

归位

💻 🐛

skamensky

💻 🤔 📖

dependabot[bot]

💻 🚧

Damian Sieradzki

💵

John Dorman

💵

Ian Sinnott

💵

Arden Shackelford

💵

Bironou

💵

CharlieGo_

💵

overnet

💵

jugglingjsons

💵

Selvin Ortiz

💵

ZanderCodes

💵

Michael Voronov

💵

letheanVPN

💵

Tai Groot

💵

easy-web-it

💵

Michael Olson

💵

EdenNetwork Italia

💵

ondoki

💵

QuEST Rail LLC

💵

Gilgameš

💵

Bernt-Johan Bergshaven

💵

Liam Bigelow

💵

Nick Arellano

💵

Frank Chiarulli Jr.

💵

Tyler

💵

Trea Hauet

💵

Kent 'picat' Gruber

💵

tc-hib

💵

Antonio

📖

MyNameIsAres

📖
+ + + + + + +## Special Mentions + +- [John Chadwick](https://github.com/jchv) - His amazing work on [go-webview2](https://github.com/jchv/go-webview2) and [go-winloader](https://github.com/jchv/go-winloader) have made the Windows version possible. +- [Tad Vizbaras](https://github.com/tadvi) - His winc project was the first step down the path to a pure Go Wails. +- [Mat Ryer](https://github.com/matryer) - For advice, support and bants. +- [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot) - His support and feedback has been invaluable. +- [Justen Walker](https://github.com/justenwalker/) - For helping wrangle COM issues which got v2 over the line. +- [Wang, Chi](https://github.com/patr0nus/) - The DeskGap project was a huge influence on the direction of Wails v2. +- [Serge Zaitsev](https://github.com/zserge) - Whilst Wails does not use the Webview project, it is still a source of inspiration. diff --git a/website/i18n/ru/docusaurus-plugin-content-pages/faq.md b/website/i18n/ru/docusaurus-plugin-content-pages/faq.md new file mode 100644 index 000000000..32cce9075 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-pages/faq.md @@ -0,0 +1 @@ +# FAQ \ No newline at end of file diff --git a/website/i18n/ru/docusaurus-plugin-content-pages/markdown-page.md b/website/i18n/ru/docusaurus-plugin-content-pages/markdown-page.md new file mode 100644 index 000000000..9756c5b66 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-pages/markdown-page.md @@ -0,0 +1,7 @@ +--- +title: Markdown page example +--- + +# Markdown page example + +You don't need React to write simple standalone pages. diff --git a/website/i18n/ru/docusaurus-plugin-content-pages/stats.mdx b/website/i18n/ru/docusaurus-plugin-content-pages/stats.mdx new file mode 100644 index 000000000..dd174cd99 --- /dev/null +++ b/website/i18n/ru/docusaurus-plugin-content-pages/stats.mdx @@ -0,0 +1,24 @@ +# Website Stats + +To enable us to understand how better to focus our efforts on translations and platform support, we use [Plausible](https://plausible.io/privacy-focused-web-analytics) to gather **anonymous** stats like country and platform. We chose Plausible because we believe in respecting the privacy of our users. We also believe in transparency, therefore have made the dashboard public. + +If you have any concerns or suggestions, please raise them in the projects github discussions. + + + + + +export const NewComponent = () => ( +
+