From 4a1b9d33c2152851b36c1b3b4dedd7adb049966b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Thu, 20 Nov 2025 16:53:42 +0900 Subject: [PATCH 1/8] i18n: start working on Catalan file structure --- content/ca-ES/download.smd | 23 + content/ca-ES/download/community-mirrors.smd | 92 +++ content/ca-ES/index.smd | 64 ++ content/ca-ES/learn/build-system.smd | 470 ++++++++++++++ content/ca-ES/learn/getting-started.smd | 159 +++++ content/ca-ES/learn/index.smd | 74 +++ content/ca-ES/learn/overview.smd | 634 +++++++++++++++++++ content/ca-ES/learn/samples.smd | 48 ++ content/ca-ES/learn/tools.smd | 41 ++ content/ca-ES/learn/why_zig_rust_d_cpp.smd | 158 +++++ content/ca-ES/zsf.smd | 86 +++ i18n/ca-ES.ziggy | 28 + zine.ziggy | 6 + 13 files changed, 1883 insertions(+) create mode 100644 content/ca-ES/download.smd create mode 100644 content/ca-ES/download/community-mirrors.smd create mode 100644 content/ca-ES/index.smd create mode 100644 content/ca-ES/learn/build-system.smd create mode 100644 content/ca-ES/learn/getting-started.smd create mode 100644 content/ca-ES/learn/index.smd create mode 100644 content/ca-ES/learn/overview.smd create mode 100644 content/ca-ES/learn/samples.smd create mode 100644 content/ca-ES/learn/tools.smd create mode 100644 content/ca-ES/learn/why_zig_rust_d_cpp.smd create mode 100644 content/ca-ES/zsf.smd create mode 100644 i18n/ca-ES.ziggy diff --git a/content/ca-ES/download.smd b/content/ca-ES/download.smd new file mode 100644 index 000000000..bc6199e23 --- /dev/null +++ b/content/ca-ES/download.smd @@ -0,0 +1,23 @@ +--- +.title = "Download", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "download.shtml", +.custom = { + "mobile_menu_title": "Download", + "OSs": ["Windows", "macOS", "Linux", "FreeBSD", "NetBSD"], +}, +--- +# Releases +You can also [install Zig from a package manager](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager). + +There is a [JSON version of this page]($link.siteAsset('download/index.json')). + +Files are signed with [minisign](https://jedisct1.github.io/minisign/) using this public key: + +``` +RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U +``` + +> # [Setting up an automation?]($block) +> If you're automating the process of downloading Zig, you might want to learn about [Community Mirrors](/download/community-mirrors) to avoid downtime and help us save on bandwidth costs. diff --git a/content/ca-ES/download/community-mirrors.smd b/content/ca-ES/download/community-mirrors.smd new file mode 100644 index 000000000..0d3f2c4e9 --- /dev/null +++ b/content/ca-ES/download/community-mirrors.smd @@ -0,0 +1,92 @@ +--- +.title = "Community Mirrors", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "download/community-mirrors.shtml", +.alternatives = [{ + .name = "list", + .layout = "download/community-mirrors-list.shtml", + .output = "/download/community-mirrors.txt", +}], +.custom = { "mobile_menu_title": "Mirrors" }, +--- + +If you're setting something up which will automatically download Zig, like CI, you might be interested in using community mirrors instead of downloading from +ziglang.org. + +The ziglang.org website does not offer any uptime or speed guarantees, meaning that your CI will sporadically fail or have slower runs if it hardcodes it as a +download URL. In fact, configuring your CI to fetch from ziglang.org directly contributes to uptime and speed issues, because this site is [intentionally hosted +on a simple one-computer configuration](https://ziglang.org/news/migrate-to-self-hosting). Instead, it is often a good idea to fetch Zig from one of many community-maintained +mirrors. These mirrors are not officially endorsed by the Zig Software Foundation, but they can be used without security risks thanks to our signing of +archives. While no individual mirror has an uptime or speed guarantee, configuring your automation to cycle through the list of available mirrors can +effectively guarantee high uptime in practice. + +> # [Security Notice]($block) +> Community mirrors are not officially trusted or endorsed by the Zig Software Foundation, and could in theory serve malicious binaries. If you are using them, +> you **must** make sure to validate the minisign signature for every tarball you download against the ZSF's public key, available on [the download +> page](/download). + +## GitHub Actions + +If you are setting up an automation using GitHub Actions, you may be interested in the +[mlugg/setup-zig](https://github.com/marketplace/actions/setup-zig-compiler) Action (note that this is not an official ZSF project). Not only does it install a +Zig version of your choice from a community mirror, but it also saves your Zig cache directory between workflow runs, allowing for faster rebuilds. + +## Using Mirrors + +The list of community mirrors is available in a newline-separated ASCII text file at https://ziglang.org/download/community-mirrors.txt. Tooling is recommended +to fetch this list and try mirrors in a randomized order (to avoid putting excessive load on any one mirror, as this slows it down for everyone). + +Every Zig tarball is associated with a [minisign](https://jedisct1.github.io/minisign/) signature file, which can also be downloaded from mirrors. **When you +download a tarball from a mirror, you must also download its associated signature and verify the tarball against it.** Failing to check the signature could +theoretically leave you vulnerable to malicious mirrors hosting modified tarballs. + +Put simply, the recommended strategy is approximately this pseudocode: + +```python +pubkey = "(copy this from https://ziglang.org/download)" +tarball_name = "zig-x86_64-linux-0.14.1.tar.xz" +# To improve uptime, optionally cache this GET: +mirrors = http_get("https://ziglang.org/download/community-mirrors.txt") +# ASCII-encoded, one mirror per line, newlines are LF, there is a trailing newline. +shuffled = shuffle_lines(mirrors) +for mirror_url in shuffled: + tarball = http_get(f"{mirror_url}/{tarball_name}?source=my_automation_name") + if success: + # NEVER SKIP THIS STEP. The signature must be verified before the tarball is deemed safe. + signature = http_get(f"{mirror_url}/{tarball_name}.minisig?source=my_automation_name") + if success and minisign_verify(tarball, signature, pubkey): + print("Successfully fetched Zig 0.14.1!") +``` + +Because ziglang.org does not have guaranteed uptime, the `community-mirrors.txt` file may at times become inaccessible. For this reason, you may wish to +consider caching its contents to prevent disruption in the event that ziglang.org encounters downtime. The recommended refetch interval is approximately +once per day. At this point in time, mirrors may be added or removed on a monthly basis as the ecosystem evolves, so periodic re-fetching is essential. + +Written more precisely, here is the key information and recommend workflow for downloading Zig tarballs: + +* The mirror list file is available at https://ziglang.org/download/community-mirrors.txt. + * Because ziglang.org does not guarantee uptime, it may be desirable to cache this file. +* The mirror list file contains ASCII-encoded mirror URLs, separated with newline characters (ASCII LF 0x20). There is a trailing newline. There is no other whitespace. There are no blank lines. +* Mirrors are required to support HTTPS. Every line in the mirror list file begins with "https://". +* Mirrors cannot guarantee uptime, so if one fails to serve you a tarball, you should try another. Ideally, shuffle the list, and try each mirror in turn. + * Usually, the first one will work. If no mirror works, you may choose to try `ziglang.org` as a final fallback. +* To download a tarball from a mirror, perform a GET request to "mirror/filename", where "mirror" is the mirror URL, and "filename" is the basename of the corresponding tarball on ziglang.org (e.g. `zig-x86_64-linux-0.14.1.tar.xz`). + * You are highly encouraged to include in your request a query parameter named `source` containing a string indicating what is making this request. For instance, the `mlugg/setup-zig` GitHub Action passes it as `?source=github-mlugg-setup-zig`. + * Source tarballs, bootstrap tarballs, and binary tarballs are available from all listed mirrors, as well as minisign signatures for all such files. + * Binary tarballs for recent Zig versions are of the form `zig-x86_64-linux-0.14.1.tar.xz`. + * If a mirror responds with a HTTP status code other than 200 OK: + * `503 Unavailable` may indicate scheduled downtime. + * `429 Too Many Requests` may indicate intentional rate-limiting. + * `404 Not Found` is a permitted response when requesting Zig releases 0.5.0 or earlier, or Zig development builds earlier than the current latest release. + * `504 Gateway Timeout` indicates that the tarball is unavailable because `https://ziglang.org/` is currently inaccessible (and the tarball is not in the mirror's cache). + * Otherwise, feel free to [open an issue](https://github.com/ziglang/www.ziglang.org/issues/new) to inform us of the problem. +* The Zig Software Foundation can never guarantee the security of any mirror, so every time a tarball is downloaded, it is **essential** to also download the minisign signature (suffix the filename with ".minisig") and verify it against the ZSF's public key (which you should copy from the ziglang.org/download page). **Never skip this step.** + * If a mirror responds with `200 OK` but signature validation fails on the returned tarball, feel free to [open an issue](https://github.com/ziglang/www.ziglang.org/issues/new) to inform us of the problem. +* When the minisig signature is verified, it is also necessary to validate its **trusted comment** (which the reference implementation `minisign` always does), and ensure that its "file" field matches the name of the requested tarball, to prevent downgrade attacks. + +## Hosting a Mirror + +If you are interested in hosting a mirror, please consult the [documentation in the www.ziglang.org +repository](https://github.com/ziglang/www.ziglang.org/blob/main/MIRRORS.md). Thank you for helping +to improve and decentralize the Zig ecosystem! diff --git a/content/ca-ES/index.smd b/content/ca-ES/index.smd new file mode 100644 index 000000000..374921529 --- /dev/null +++ b/content/ca-ES/index.smd @@ -0,0 +1,64 @@ +--- +.title = "Home", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "index.shtml", +.custom = { + "mobile_menu_title": "Home", +}, +--- + +[]($section.id("slogan")) +Zig is a general-purpose programming language and toolchain for maintaining **robust**, **optimal** and **reusable** software. + +[]($section.id("features")) +## ⚡ A Simple Language +Focus on debugging your application rather than debugging your programming language knowledge. + +- No hidden control flow. +- No hidden memory allocations. +- No preprocessor, no macros. + +## ⚡ Comptime +A fresh approach to metaprogramming based on compile-time code execution and lazy evaluation. + +- Call any function at compile-time. +- Manipulate types as values without runtime overhead. +- Comptime emulates the target architecture. + +## ⚡ Maintain it with Zig +Incrementally improve your C/C++/Zig codebase. + +- Use Zig as a zero-dependency, drop-in C/C++ compiler that supports cross-compilation out-of-the-box. +- Leverage `zig build` to create a consistent development environment across all platforms. +- Add a Zig compilation unit to C/C++ projects, exposing the rich standard library to your C/C++ code. + + +# [Community]($section.id("community").attrs("section-title")) + +## [The Zig community is decentralized]($section.id("decentralized")) +Anyone is free to start and maintain their own space for the community to gather. +There is no concept of "official" or "unofficial", however, each gathering place has its own moderators and rules. + + +## [Main development]($section.id("main-development")) +The Zig repository can be found at [https://github.com/ziglang/zig](https://github.com/ziglang/zig), where we also host the issue tracker and discuss proposals. +Contributors are expected to follow Zig's [Code of Conduct](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md). + + +# [Zig Software Foundation]($section.id("zsf").attrs("section-title")) + +## The ZSF is a 501(c)(3) non-profit corporation. + +The Zig Software Foundation is a non-profit corporation founded in 2020 by Andrew Kelley, the creator of Zig, with the goal of supporting the development of the language. Currently, the ZSF is able to offer paid work at competitive rates to a small number of core contributors. We hope to be able to extend this offer to more core contributors in the future. + +The Zig Software Foundation is sustained by donations. + +# [Sponsors]($section.id("sponsors").attrs("section-title")) + +## [Corporate Sponsors]($section.id("corporate-sponsors")) +The following companies are providing direct financial support to the Zig Software foundation. + +## [GitHub Sponsors]($section.id("github-sponsors")) +Thanks to people who [sponsor Zig]($link.page('zsf')), the project is accountable to the open source community rather than corporate shareholders. In particular, these fine folks sponsor Zig for $200/month or more: + diff --git a/content/ca-ES/learn/build-system.smd b/content/ca-ES/learn/build-system.smd new file mode 100644 index 000000000..0b35b559f --- /dev/null +++ b/content/ca-ES/learn/build-system.smd @@ -0,0 +1,470 @@ +--- +.title = "Zig Build System", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Zig Build System", + "toc": true, +}, +--- +# [When to bust out the Zig Build System?]($heading.id('build-system')) + +The fundamental commands `zig build-exe`, `zig build-lib`, `zig build-obj`, and +`zig test` are often sufficient. However, sometimes a project needs another +layer of abstraction to manage the complexity of building from source. + +For example, perhaps one of these situations applies: + +- The command line becomes too long and unwieldy, and you want some place to + write it down. +- You want to build many things, or the build process contains many steps. +- You want to take advantage of concurrency and caching to reduce build time. +- You want to expose configuration options for the project. +- The build process is different depending on the target system and other options. +- You have dependencies on other projects. +- You want to avoid an unnecessary dependency on cmake, make, shell, msvc, + python, etc., making the project accessible to more contributors. +- You want to provide a package to be consumed by third parties. +- You want to provide a standardized way for tools such as IDEs to semantically understand + how to build the project. + +If any of these apply, the project will benefit from using the Zig Build System. + +# [Getting Started]($heading.id('getting-started')) +## [Simple Executable]($heading.id('simple')) +This build script creates an executable from a Zig file that contains a public `main` function definition. + +[]($code.language('=html').buildAsset("build-system/1-simple-executable/hello.zig")) +[]($code.language('=html').buildAsset("build-system/1-simple-executable/build.zig")) + +## [Installing Build Artifacts]($heading.id('installing-artifacts')) + +The Zig build system, like most build systems, is based on modeling the project as a directed acyclic graph (DAG) of steps, which are independently and concurrently run. + +By default, the main step in the graph is the **Install** step, whose purpose +is to copy build artifacts into their final resting place. The Install step +starts with no dependencies, and therefore nothing will happen when `zig build` +is run. A project's build script must add to the set of things to install, which +is what the `installArtifact` function call does above. + +**Output** +``` +├── build.zig +├── hello.zig +├── .zig-cache +└── zig-out + └── bin + └── hello +``` + +There are two generated directories in this output: `.zig-cache` and `zig-out`. The first one contains files that will make subsequent builds faster, but these files are not intended to be checked into source-control and this directory can be completely deleted at any time with no consequences. + +The second one, `zig-out`, is an "installation prefix". This maps to the standard file system hierarchy concept. This directory is not chosen by the project, but by the user of `zig build` with the `--prefix` flag (`-p` for short). + +You, as the project maintainer, pick what gets put in this directory, but the user chooses where to install it in their system. The build script cannot hardcode output paths because this would break caching, concurrency, and composability, as well as annoy the final user. + +## [Adding a Convenience Step for Running the Application]($heading.id('run-step')) + +It is common to add a **Run** step to provide a way to run one's main application directly +from the build command. + +[]($code.language('=html').buildAsset("build-system/convenience-run-step/hello.zig")) +[]($code.language('=html').buildAsset("build-system/convenience-run-step/build.zig")) + +# [The Basics]($heading.id('basics')) + +## [User-Provided Options]($heading.id('user-options')) + +Use `b.option` to make the build script configurable to end users as well as +other projects that depend on the project as a package. + +[]($code.language('=html').buildAsset("build-system/2-user-provided-options/build.zig")) +[]($code.language('=html').buildAsset("build-system/2-user-provided-options/example.zig")) + +Please direct your attention to these lines: + +``` +Project-Specific Options: + -Dwindows=[bool] Target Microsoft Windows +``` + +This part of the help menu is auto-generated based on running the `build.zig` logic. Users +can discover configuration options of the build script this way. + +## [Standard Configuration Options]($heading.id('standard-options')) + +Previously, we used a boolean flag to indicate building for Windows. However, we can do +better. + +Most projects want to provide the ability to change the target and optimization settings. +In order to encourage standard naming conventions for these options, Zig provides the +helper functions, `standardTargetOptions` and `standardOptimizeOption`. + +Standard target options allows the person running `zig build` to choose what +target to build for. By default, any target is allowed, and no choice means to +target the host system. Other options for restricting supported target set are +available. + +Standard optimization options allow the person running `zig build` to select +between `Debug`, `ReleaseSafe`, `ReleaseFast`, and `ReleaseSmall`. By default +none of the release options are considered the preferable choice by the build +script, and the user must make a decision in order to create a release build. + +[]($code.language('=html').buildAsset("build-system/3-standard-config-options/hello.zig")) +[]($code.language('=html').buildAsset("build-system/3-standard-config-options/build.zig")) + +Now, our `--help` menu contains more items: + +``` +Project-Specific Options: + -Dtarget=[string] The CPU architecture, OS, and ABI to build for + -Dcpu=[string] Target CPU features to add or subtract + -Doptimize=[enum] Prioritize performance, safety, or binary size (-O flag) + Supported Values: + Debug + ReleaseSafe + ReleaseFast + ReleaseSmall +``` + +It is entirely possible to create these options via `b.option` directly, but this +API provides a commonly used naming convention for these frequently used settings. + +In our terminal output, observe that we passed `-Dtarget=x86_64-windows -Doptimize=ReleaseSmall`. +Compared to the first example, now we see different files in the installation prefix: + +``` +zig-out/ +└── bin + └── hello.exe +``` + +## [Options for Conditional Compilation]($heading.id('conditional-compilation')) + +To pass options from the build script and into the project's Zig code, use +the `Options` step. + +[]($code.language('=html').buildAsset("build-system/conditional-compilation/app.zig")) +[]($code.language('=html').buildAsset("build-system/conditional-compilation/build.zig")) + +In this example, the data provided by `@import("config")` is comptime-known, +preventing the `@compileError` from triggering. If we had passed `-Dversion=0.2.3` +or omitted the option, then we would have seen the compilation of `app.zig` fail with +the "too old" error. + +## [Static Library]($heading.id('static-library')) + +This build script creates a static library from Zig code, and then also an +executable from other Zig code that consumes it. + +[]($code.language('=html').buildAsset("build-system/simple-static-library/fizzbuzz.zig")) +[]($code.language('=html').buildAsset("build-system/simple-static-library/demo.zig")) +[]($code.language('=html').buildAsset("build-system/simple-static-library/build.zig")) + +In this case, only the static library ends up being installed: + +``` +zig-out/ +└── lib + └── libfizzbuzz.a +``` + +However, if you look closely, the build script contains an option to also install the demo. +If we additionally pass `-Denable-demo`, then we see this in the installation prefix: + +``` +zig-out/ +├── bin +│   └── demo +└── lib + └── libfizzbuzz.a +``` + +Note that despite the unconditional call to `addExecutable`, the build system in fact +does not waste any time building the `demo` executable unless it is requested +with `-Denable-demo`, because the build system is based on a Directed Acyclic +Graph with dependency edges. + +## [Dynamic Library]($heading.id('dynamic-library')) + +Here we keep all the files the same from the [Static Library](#static-library) example, except +the `build.zig` file is changed. + +[]($code.language('=html').buildAsset("build-system/dynamic-library/build.zig")) + +**Output** +``` +zig-out +└── lib + ├── libfizzbuzz.so -> libfizzbuzz.so.1 + ├── libfizzbuzz.so.1 -> libfizzbuzz.so.1.2.3 + └── libfizzbuzz.so.1.2.3 +``` + +As in the static library example, to make an executable link against it, use code like this: + +```zig +exe.linkLibrary(libfizzbuzz); +``` + +## [Testing]($heading.id('testing')) + +Individual files can be tested directly with `zig test foo.zig`, however, more +complex use cases can be solved by orchestrating testing via the build script. + +When using the build script, unit tests are broken into two different steps in +the build graph, the **Compile** step and the **Run** step. Without a call to +`addRunArtifact`, which establishes a dependency edge between these two steps, +the unit tests will not be executed. + +The *Compile* step can be configured the same as any executable, library, or +object file, for example by [linking against system libraries](#linking-to-system-libraries), +setting target options, or adding additional compilation units. + +The *Run* step can be configured the same as any Run step, for example by +skipping execution when the host is not capable of executing the binary. + +When using the build system to run unit tests, the build runner and the test +runner communicate via *stdin* and *stdout* in order to run multiple unit test +suites concurrently, and report test failures in a meaningful way without +having their output jumbled together. This is one reason why +[writing to *standard out* in unit tests is problematic](https://github.com/ziglang/zig/issues/15091) - +it will interfere with this communication channel. On the flip side, this +mechanism will enable an upcoming feature, which is is the +[ability for a unit test to expect a *panic*](https://github.com/ziglang/zig/issues/1356). + +[]($code.language('=html').buildAsset("build-system/unit-testing/main.zig")) +[]($code.language('=html').buildAsset("build-system/unit-testing/build.zig")) + +In this case it might be a nice adjustment to enable `skip_foreign_checks` for +the unit tests: + +```diff +@@ -23,6 +23,7 @@ + }); + + const run_unit_tests = b.addRunArtifact(unit_tests); ++ run_unit_tests.skip_foreign_checks = true; + test_step.dependOn(&run_unit_tests.step); + } + } +``` + +[]($code.language('=html').buildAsset("build-system/unit-testing-skip-foreign/build.zig")) + +## [Linking to System Libraries]($heading.id('linking-to-system-libraries')) + +For satisfying library dependencies, there are two choices: + +1. Provide these libraries via the Zig Build System + (see [Package Management](#) and [Static Library](#static-library)). +2. Use the files provided by the host system. + +For the use case of upstream project maintainers, obtaining these libraries via +the Zig Build System provides the least friction and puts the configuration +power in the hands of those maintainers. Everyone who builds this way will have +reproducible, consistent results as each other, and it will work on every +operating system and even support cross-compilation. Furthermore, it allows the +project to decide with perfect precision the exact versions of its entire +dependency tree it wishes to build against. This is expected to be the +generally preferred way to depend on external libraries. + +However, for the use case of packaging software into repositories such as +Debian, Homebrew, or Nix, it is mandatory to link against system libraries. So, +build scripts must +[detect the build mode](https://github.com/ziglang/zig/issues/14281) and configure accordingly. + +[]($code.language('=html').buildAsset("build-system/system-libraries/build.zig")) + +Users of `zig build` may use `--search-prefix` to provide additional +directories that are considered "system directories" for the purposes of finding +static and dynamic libraries. + +# [Generating Files]($heading.id('generating-files')) + +## [Running System Tools]($heading.id('system-tools')) +This version of hello world expects to find a `word.txt` file in the same path, +and we want to use a system tool to generate it starting from a JSON file. + +Be aware that system dependencies will make your project harder to build for your +users. This build script depends on `jq`, for example, which is not present by +default in most Linux distributions and which might be an unfamiliar tool for +Windows users. + +The next section will replace `jq` with a Zig tool included in the source tree, +which is the preferred approach. + +**`words.json`** +```json +{ + "en": "world", + "it": "mondo", + "ja": "世界" +} +``` + +[]($code.language('=html').buildAsset("build-system/10.5-system-tool/src/main.zig")) +[]($code.language('=html').buildAsset("build-system/10.5-system-tool/build.zig")) + +**Output** + +``` +zig-out +├── hello +└── word.txt +``` + +Note how `captureStdOut` creates a temporary file with the output of the `jq` invocation. + +## [Running the Project's Tools]($heading.id('project-tools')) + +This version of hello world expects to find a `word.txt` file in the same path, +and we want to produce it at build-time by invoking a Zig program on a JSON file. + +**`tools/words.json`** +```json +{ + "en": "world", + "it": "mondo", + "ja": "世界" +} +``` + +[]($code.language('=html').buildAsset("build-system/11-zig-tool/src/main.zig")) + +[]($code.language('=html').buildAsset("build-system/11-zig-tool/tools/word_select.zig")) + +[]($code.language('=html').buildAsset("build-system/11-zig-tool/build.zig")) + +**Output** + +``` +zig-out +├── hello +└── word.txt +``` + + +## [Producing Assets for `@embedFile`]($heading.id('embed-file')) + +This version of hello world wants to `@embedFile` an asset generated at build time, +which we're going to produce using a tool written in Zig. + +**`tools/words.json`** +```json +{ + "en": "world", + "it": "mondo", + "ja": "世界" +} +``` + +[]($code.language('=html').buildAsset("build-system/12-embedfile/src/main.zig")) + +[]($code.language('=html').buildAsset("build-system/12-embedfile/tools/word_select.zig")) + +[]($code.language('=html').buildAsset("build-system/12-embedfile/build.zig")) + +**Output** + +``` +zig-out/ +└── bin +    └── hello +``` + +## [Generating Zig Source Code]($heading.id('generating-zig')) +This build file uses a Zig program to generate a Zig file and then exposes it +to the main program as a module dependency. + +[]($code.language('=html').buildAsset("build-system/13-import/src/main.zig")) +[]($code.language('=html').buildAsset("build-system/13-import/tools/generate_struct.zig")) +[]($code.language('=html').buildAsset("build-system/13-import/build.zig")) + +**Output** + +``` +zig-out/ +└── bin +    └── hello +``` + +## [Dealing With One or More Generated Files]($heading.id('write-files')) + +The **WriteFiles** step provides a way to generate one or more files which +share a parent directory. The generated directory lives inside the local `.zig-cache`, +and each generated file is independently available as a `std.Build.LazyPath`. +The parent directory itself is also available as a `LazyPath`. + +This API supports writing arbitrary strings to the generated directory as well +as copying files into it. + +[]($code.language('=html').buildAsset("build-system/write-files/src/main.zig")) +[]($code.language('=html').buildAsset("build-system/write-files/build.zig")) + +**Output** + +``` +zig-out/ +└── project.tar.gz +``` + +## [Mutating Source Files in Place]($heading.id('mutating-source')) + +It is uncommon, but sometimes the case that a project commits generated files +into version control. This can be useful when the generated files are seldomly updated +and have burdensome system dependencies for the update process, but *only* during the +update process. + +For this, **WriteFiles** provides a way to accomplish this task. This is a feature that +[will be extracted from WriteFiles into its own Build Step](https://github.com/ziglang/zig/issues/14944) +in a future Zig version. + +Be careful with this functionality; it should not be used during the normal +build process, but as a utility run by a developer with intention to update +source files, which will then be committed to version control. If it is done +during the normal build process, it will cause caching and concurrency bugs. + +[]($code.language('=html').buildAsset("build-system/mutate-source-files/tools/proto_gen.zig")) +[]($code.language('=html').buildAsset("build-system/mutate-source-files/src/main.zig")) +[]($code.language('=html').buildAsset("build-system/mutate-source-files/src/protocol.zig")) +[]($code.language('=html').buildAsset("build-system/mutate-source-files/build.zig")) + +```=html +
$ zig build update-protocol --summary all
+Build Summary: 4/4 steps succeeded
+update-protocol success
+└─ WriteFile success
+   └─ run proto_gen (protocol.zig) success 401us MaxRSS:1M
+      └─ zig build-exe proto_gen Debug native success 1s MaxRSS:183M
+
+``` + +After running this command, `src/protocol.zig` is updated in place. + +# [Handy Examples]($heading.id('examples')) + +## [Build for multiple targets to make a release]($heading.id('release')) + +In this example we're going to change some defaults when creating an `InstallArtifact` step in order to put the build for each target into a separate subdirectory inside the install path. + +[]($code.language('=html').buildAsset("build-system/10-release/build.zig")) +[]($code.language('=html').buildAsset("build-system/10-release/hello.zig")) + +**Output** + +``` +zig-out +├── aarch64-linux +│   └── hello +├── aarch64-macos +│   └── hello +├── x86_64-linux-gnu +│   └── hello +├── x86_64-linux-musl +│   └── hello +└── x86_64-windows + ├── hello.exe + └── hello.pdb +``` diff --git a/content/ca-ES/learn/getting-started.smd b/content/ca-ES/learn/getting-started.smd new file mode 100644 index 000000000..c323fa0f2 --- /dev/null +++ b/content/ca-ES/learn/getting-started.smd @@ -0,0 +1,159 @@ +--- +.title = "Getting Started", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Getting Started", + "toc": true, +}, +--- + +# Tagged release or nightly build? +Zig has not yet reached v1.0 and the current release cycle is tied to new releases of LLVM, which have a ~6 months cadence. +In practical terms, **Zig releases tend to be far apart and eventually become stale given the current speed of development**. + +It's fine to evaluate Zig using a tagged version, but if you decide that you like Zig and +want to dive deeper, **we encourage you to upgrade to a nightly build**, mainly because +that way it will be easier for you to get help: most of the community and sites like +[zig.guide](https://zig.guide) track the master branch for the reasons stated above. + +The good news is that it's very easy to switch from one Zig version to another, or even have multiple versions present on the system at the same time: Zig releases are self-contained archives that can be placed anywhere in your system. + + +# Installing Zig +## [Direct download]($heading.id('direct')) +This is the most straight-forward way of obtaining Zig: grab a Zig bundle for your platform from the [Downloads](/download) page, +extract it in a directory and add it to your `PATH` to be able to call `zig` from any location. + +### Setting up PATH on Windows +To setup your path on Windows run **one** of the following snippets of code in a Powershell instance. +Choose if you want to apply this change on a system-wide level (requires running Powershell with admin privileges) +or just for your user, and **make sure to change the snippet to point at the location where your copy of Zig lies**. +The `;` before `C:` is not a typo. + +System wide (**admin** Powershell): +``` +[Environment]::SetEnvironmentVariable( + "Path", + [Environment]::GetEnvironmentVariable("Path", "Machine") + ";C:\your-path\zig-windows-x86_64-your-version", + "Machine" +) +``` + +User level (Powershell): +``` +[Environment]::SetEnvironmentVariable( + "Path", + [Environment]::GetEnvironmentVariable("Path", "User") + ";C:\your-path\zig-windows-x86_64-your-version", + "User" +) +``` +After you're done, restart your Powershell instance. + +### Setting up PATH on Linux, macOS, BSD +Add the location of your zig binary to your PATH environment variable. + +This is generally done by adding an export line to your shell startup script (`.profile`, `.zshrc`, ...) +```bash +export PATH=$PATH:~/path/to/zig +``` +After you're done, either `source` your startup file or restart your shell. + + + + +## [Package managers]($heading.id('managers')) +### Windows +**WinGet** +Zig is available on [WinGet](https://github.com/microsoft/winget-pkgs/tree/master/manifests/z/zig/zig). +``` +winget install -e --id zig.zig +``` + +**Chocolatey** +Zig is available on [Chocolatey](https://chocolatey.org/packages/zig). +``` +choco install zig +``` + +**Scoop** +Zig is available on [Scoop](https://scoop.sh/#/apps?q=zig&id=7e124d6047c32d426e4143ab395d863fc9d6d491). +``` +scoop install zig +``` +Latest [dev build](https://scoop.sh/#/apps?q=zig&id=921df07e75042de645204262e784a17c2421944c): +``` +scoop bucket add versions +scoop install versions/zig-dev +``` + +### macOS + +**Homebrew** +Latest tagged release: +``` +brew install zig +``` + +**MacPorts** +``` +sudo port install zig +``` +### Linux +Zig is also present in many package managers for Linux. [Here](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager) +you can find an updated list but keep in mind that some packages might bundle outdated versions of Zig. + +## [Building from source]($heading.id('source')) +[Here](https://github.com/ziglang/zig/wiki/Building-Zig-From-Source) +you can find more information on how to build Zig from source for Linux, macOS and Windows. + +# Recommended tools +## Syntax Highlighters and LSP +All major text editors have syntax highlight support for Zig. +Some bundle it, some others require installing a plugin. + +If you're interested in a deeper integration between Zig and your editor, +checkout [zigtools/zls](https://github.com/zigtools/zls). + +If you're interested in what else is available, checkout the [Tools](tools) section. + + +# Run Hello World +If you completed the installation process correctly, you should now be able to invoke the Zig compiler from your shell. +Let's test this by creating your first Zig program! + +Navigate to your projects directory and run: +```bash +mkdir hello-world +cd hello-world +zig init +``` + +This should output: +``` +info: created build.zig +info: created build.zig.zon +info: created src/main.zig +info: created src/root.zig +info: see `zig build --help` for a menu of options +``` + +Running `zig build run` should then compile the executable and run it, ultimately resulting in: +``` +All your codebase are belong to us. +Run `zig build test` to run the tests. +``` + +Congratulations, you have a working Zig installation! + +# Next steps +**Check out other resources present in the [Learn](/learn) section**, make sure to find the Documentation for your version +of Zig (note: nightly builds should use `master` docs) and consider giving [zig.guide](https://zig.guide) a read. + +Zig is a young project and unfortunately we don't have yet the capacity to produce extensive documentation and learning +materials for everything, so you should consider [joining one of the existing Zig communities](https://github.com/ziglang/zig/wiki/Community) +to get help when you get stuck, as well as checking out initiatives like [Zig SHOWTIME](https://zig.show). + +Finally, if you enjoy Zig and want to help speed up the development, [consider donating to the Zig Software Foundation](/zsf) +. diff --git a/content/ca-ES/learn/index.smd b/content/ca-ES/learn/index.smd new file mode 100644 index 000000000..fd607b257 --- /dev/null +++ b/content/ca-ES/learn/index.smd @@ -0,0 +1,74 @@ +--- +.title = "Learn", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "learn.shtml", +.custom = { + "mobile_menu_title": "Learn", +}, +--- +# [Learn]($section.id('learn')) +This section lists resources useful to go from knowing nothing about Zig up +to understanding its philosophy. + + +## [Guides]($section.id('guides')) +This section is eventually going to be bundled with Zig's standard library documentation, but +in the meantime you can browse it from here. + +- [Zig Build System](./build-system/) +Introduction to the Zig build system. + +## Introduction +These are all introductions to Zig aimed at programmers with different backgrounds. + +- [In-depth Overview](./overview/) +Here's an in-depth feature overview of Zig from a systems-programming perspective. +- [Why Zig When There is Already C++, D, and Rust?](./why_zig_rust_d_cpp/) +An introduction to Zig for C++, D, and Rust programmers. +- [Code Examples](./samples/) +A list of snippets to get a feeling for how Zig code looks. +- [Tools](./tools/) +A list of useful tools that can help you write Zig code. + + +## Getting started +If you're ready to start programming in Zig, this guide will help you setup your environment. + +- [Getting started](./getting-started) + +## Online learning resources +- [Introduction to Zig: a project-based book](https://github.com/pedropark99/zig-book) +An open, technical and introductory book for Zig. +- [zig.guide](https://zig.guide) +A structured introduction to Zig by [Sobeston](https://github.com/sobeston). +- [Ziglings](https://ziglings.org) +Learn Zig by fixing tiny broken programs. +- [Zig on Exercism](https://exercism.org/tracks/zig) +Solve coding exercises and get mentored to develop fluency in Zig. +- [Learning Zig](https://www.openmymind.net/learning_zig/) +Short introduction to Zig well suited for developers coming from garbage-collected languages. + +## Relevant videos and blog posts +- [Road to Zig 1.0](https://www.youtube.com/watch?v=Gv2I7qTux7g) [video] +Video by [Andrew Kelley](https://andrewkelley.me) introducing Zig and its philosophy. +- [Zig's New Relationship with LLVM](https://kristoff.it/blog/zig-new-relationship-llvm/) +A blog post about the work towards building the Zig self-hosted compiler, also featured in [an article by lwn.net](https://lwn.net/Articles/833400/). + + + + + + + + + + + + + + + + + + diff --git a/content/ca-ES/learn/overview.smd b/content/ca-ES/learn/overview.smd new file mode 100644 index 000000000..b4841cd47 --- /dev/null +++ b/content/ca-ES/learn/overview.smd @@ -0,0 +1,634 @@ +--- +.title = "Overview", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Overview", +}, +--- +# Feature Highlights +## [Small, simple language]($heading.id('small-simple-language')) + +Focus on debugging your application rather than debugging your programming language knowledge. + +Zig's entire syntax is specified with a [580-line PEG grammar file](https://ziglang.org/documentation/master/#Grammar). + +There is **no hidden control flow**, no hidden memory allocations, no preprocessor, and no macros. If Zig code doesn't look like it's jumping away to call a function, then it isn't. This means you can be sure that the following code calls only `foo()` and then `bar()`, and this is guaranteed without needing to know the types of anything: + +```zig +var a = b + c.d; +foo(); +bar(); +``` + +Examples of hidden control flow: + +- D has `@property` functions, which are methods that you call with what looks like field access, so in the above example, `c.d` might call a function. +- C++, D, and Rust have operator overloading, so the `+` operator might call a function. +- C++, D, and Go have throw/catch exceptions, so `foo()` might throw an exception, and prevent `bar()` from being called. + + Zig promotes code maintenance and readability by making all control flow managed exclusively with language keywords and function calls. + +## [Performance and Safety: Choose Two]($heading.id('performance-and-safety-choose-two')) + +Zig has four [build modes](https://ziglang.org/documentation/master/#Build-Mode), and they can all be mixed and matched all the way down to [scope granularity](https://ziglang.org/documentation/master/#setRuntimeSafety). + +| Parameter | [Debug](https://ziglang.org/documentation/master/#Debug) | [ReleaseSafe](https://ziglang.org/documentation/master/#ReleaseSafe) | [ReleaseFast](https://ziglang.org/documentation/master/#ReleaseFast) | [ReleaseSmall](https://ziglang.org/documentation/master/#ReleaseSmall) | +|-----------|-------|-------------|-------------|--------------| +Optimizations - improve speed, harm debugging, harm compile time | | On | On | On | +Runtime Safety Checks - harm speed, harm size, crash instead of undefined behavior | On | On | | | + +Here is what [Integer Overflow](https://ziglang.org/documentation/master/#Integer-Overflow) looks like at compile time, regardless of the build mode: + +[]($code.language('=html').buildAsset('features/1-integer-overflow.zig')) + +Here is what it looks like at runtime, in safety-checked builds: + +[]($code.language('=html').buildAsset('features/2-integer-overflow-runtime.zig')) + + +Those [stack traces work on all targets](#stack-traces-on-all-targets), including [freestanding](https://andrewkelley.me/post/zig-stack-traces-kernel-panic-bare-bones-os.html). + +With Zig one can rely on a safety-enabled build mode, and selectively disable safety at the performance bottlenecks. For example the previous example could be modified like this: + +[]($code.language('=html').buildAsset('features/3-undefined-behavior.zig')) + +Zig uses [Illegal Behavior](https://ziglang.org/documentation/master/#Illegal-Behavior) as a razor sharp tool for both bug prevention and performance enhancement. + +Speaking of performance, Zig is faster than C. + +- All Zig code lives in one compilation unit, optimized together. +- Carefully chosen illegal behavior. For example, in Zig both signed and unsigned integers have illegal behavior on overflow, contrasted to only signed integers in C. This [facilitates optimizations that are not available in C](https://godbolt.org/z/vhjv9oM1W). +- Zig directly exposes a [SIMD vector type](https://ziglang.org/documentation/master/#Vectors), making it easy to write portable vectorized code. +- The standard library provides essential data structures such as hash maps and array lists, whereas in C it is tempting to use linked lists for simplicity. +- Advanced CPU features are enabled by default, unless [cross-compiling](#cross-compiling-is-a-first-class-use-case). + +Please note that Zig is not a fully safe language. For those interested in following Zig's safety story, subscribe to these issues: + +- [enumerate all kinds of undefined behavior, even that which cannot be safety-checked](https://github.com/ziglang/zig/issues/1966) +- [make Debug and ReleaseSafe modes fully safe](https://github.com/ziglang/zig/issues/2301) + +## Zig competes with C instead of depending on it + +The Zig Standard Library integrates with libc, but does not depend on it. Here's Hello World: + +[]($code.language('=html').buildAsset('features/4-hello.zig')) + +When compiled with `-O ReleaseSmall`, debug symbols stripped, single-threaded mode, this produces a 9.8 KiB static executable for the x86_64-linux target: +``` +$ zig build-exe hello.zig -O ReleaseSmall -fstrip -fsingle-threaded +$ wc -c hello +9944 hello +$ ldd hello + not a dynamic executable +``` + +A Windows build is even smaller, coming out to 4096 bytes: +``` +$ zig build-exe hello.zig -O ReleaseSmall -fstrip -fsingle-threaded -target x86_64-windows +$ wc -c hello.exe +4096 hello.exe +$ file hello.exe +hello.exe: PE32+ executable (console) x86-64, for MS Windows +``` + +## Order independent top level declarations + +Top level declarations such as global variables are order-independent and lazily analyzed. The initialization values of global variables are [evaluated at compile-time](#compile-time-reflection-and-compile-time-code-execution). + +[]($code.language('=html').buildAsset('features/5-global-variables.zig')) + +## Optional type instead of null pointers + +In other programming languages, null references are the source of many runtime exceptions, and even stand accused of being [the worst mistake of computer science](https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/). + +Unadorned Zig pointers cannot be null: + +[]($code.language('=html').buildAsset('features/6-null-to-ptr.zig')) + +However any type can be made into an [optional type](https://ziglang.org/documentation/master/#Optionals) by prefixing it with `?`: + +[]($code.language('=html').buildAsset('features/7-optional-syntax.zig')) + +To unwrap an optional value, one can use `orelse` to provide a default value: + +[]($code.language('=html').buildAsset('features/8-optional-orelse.zig')) + +Another option is to use if: + +[]($code.language('=html').buildAsset('features/9-optional-if.zig')) + + The same syntax works with [while](https://ziglang.org/documentation/master/#while): + +[]($code.language('=html').buildAsset('features/10-optional-while.zig')) + +## Manual memory management + +A library written in Zig is eligible to be used anywhere: + +- [Desktop applications](https://github.com/TM35-Metronome/) +- Low latency servers +- [Operating System kernels](https://github.com/AndreaOrru/zen) +- [Embedded devices](https://github.com/skyfex/zig-nrf-demo/) +- Real-time software, e.g. live performances, airplanes, pacemakers +- [In web browsers or other plugins with WebAssembly](https://shritesh.github.io/zigfmt-web/) +- By other programming languages, using the C ABI + +In order to accomplish this, Zig programmers must manage their own memory, and must handle memory allocation failure. + +This is true of the Zig Standard Library as well. Any functions that need to allocate memory accept an allocator parameter. As a result, the Zig Standard Library can be used even for the freestanding target. + +In addition to [A fresh take on error handling](#a-fresh-take-on-error-handling), Zig provides [defer](https://ziglang.org/documentation/master/#defer) and [errdefer](https://ziglang.org/documentation/master/#errdefer) to make all resource management - not only memory - simple and easily verifiable. + +For an example of `defer`, see [Integration with C libraries without FFI/bindings](#integration-with-c-libraries-without-ffibindings). Here is an example of using `errdefer`: +[]($code.language('=html').buildAsset('features/11-errdefer.zig')) + + +## [A fresh take on error handling]($heading.id('a-fresh-take-on-error-handling')) + +Errors are values, and may not be ignored: + +[]($code.language('=html').buildAsset('features/12-errors-as-values.zig')) + +Errors can be handled with [catch](https://ziglang.org/documentation/master/#catch): + +[]($code.language('=html').buildAsset('features/13-errors-catch.zig')) + +The keyword [try](https://ziglang.org/documentation/master/#try) is a shortcut for `catch |err| return err`: + +[]($code.language('=html').buildAsset('features/14-errors-try.zig')) + +Note that is an [Error Return Trace](https://ziglang.org/documentation/master/#Error-Return-Traces), not a [stack trace](#stack-traces-on-all-targets). The code did not pay the price of unwinding the stack to come up with that trace. + +The [switch](https://ziglang.org/documentation/master/#switch) keyword used on an error ensures that all possible errors are handled: + +[]($code.language('=html').buildAsset('features/15-errors-switch.zig')) + +The keyword [unreachable](https://ziglang.org/documentation/master/#unreachable) is used to assert that no errors will occur: + +[]($code.language('=html').buildAsset('features/16-unreachable.zig')) + +This invokes [undefined behavior](#performance-and-safety-choose-two) in the unsafe build modes, so be sure to use it only when success is guaranteed. + +### [Stack traces on all targets]($heading.id("stack-traces-on-all-targets")) + +The stack traces and [error return traces](https://ziglang.org/documentation/master/#Error-Return-Traces) shown on this page work on all Tier 1 Support and some Tier 2 Support targets. [Even freestanding](https://andrewkelley.me/post/zig-stack-traces-kernel-panic-bare-bones-os.html)! + +In addition, the standard library has the ability to capture a stack trace at any point and then dump it to standard error later: + +[]($code.language('=html').buildAsset('features/17-stack-traces.zig')) + +The standard library's DebugAllocator uses this technique to report leaks and double frees. + +## Generic data structures and functions + +Types are values that must be known at compile-time: + +[]($code.language('=html').buildAsset('features/18-types.zig')) + +A generic data structure is simply a function that returns a `type`: + +[]($code.language('=html').buildAsset('features/19-generics.zig')) + +## [Compile-time reflection and compile-time code execution]($heading.id('compile-time-reflection-and-compile-time-code-execution')) + +The [@typeInfo](https://ziglang.org/documentation/master/#typeInfo) builtin function provides reflection: + +[]($code.language('=html').buildAsset('features/20-reflection.zig')) + +The Zig Standard Library uses this technique to implement formatted printing. Despite being a [Small, simple language](#small-simple-language), Zig's formatted printing is implemented entirely in Zig. Meanwhile, in C, compile errors for printf are hard-coded into the compiler. Similarly, in Rust, the formatted printing macro is hard-coded into the compiler. + +Zig can also evaluate functions and blocks of code at compile-time. In some contexts, such as global variable initializations, the expression is implicitly evaluated at compile-time. Otherwise, one can explicitly evaluate code at compile-time with the [comptime](https://ziglang.org/documentation/master/#comptime) keyword. This can be especially powerful when combined with assertions: + +[]($code.language('=html').buildAsset('features/21-comptime.zig')) + +## [Integration with C libraries without FFI/bindings]($heading.id('integration-with-c-libraries-without-ffibindings')) + +[@cImport](https://ziglang.org/documentation/master/#cImport) directly imports types, variables, functions, and simple macros for use in Zig. It even translates inline functions from C into Zig. + +Here is an example of emitting a sine wave using [libsoundio](http://libsound.io/): + +sine.zig +[]($code.language('=html').buildAsset('features/22-sine-wave.zig')) + +``` +$ zig build-exe sine.zig -lsoundio -lc +$ ./sine +Output device: Built-in Audio Analog Stereo +^C +``` + +[This Zig code is significantly simpler than the equivalent C code](https://gist.github.com/andrewrk/d285c8f912169329e5e28c3d0a63c1d8), as well as having more safety protections, and all this is accomplished by directly importing the C header file - no API bindings. + +*Zig is better at using C libraries than C is at using C libraries.* + +### [Zig is also a C compiler]($heading.id('zig-is-also-a-c-compiler')) + +Here's an example of Zig building some C code: + +hello.c +```c +#include + +int main(int argc, char **argv) { + printf("Hello world\n"); + return 0; +} +``` + +``` +$ zig build-exe hello.c -lc +$ ./hello +Hello world +``` + +You can use `--verbose-cc` to see what C compiler command this executed: +``` +$ zig build-exe hello.c -lc --verbose-cc +zig cc -MD -MV -MF .zig-cache/tmp/42zL6fBH8fSo-hello.o.d -nostdinc -fno-spell-checking -isystem /home/andy/dev/zig/build/lib/zig/include -isystem /home/andy/dev/zig/build/lib/zig/libc/include/x86_64-linux-gnu -isystem /home/andy/dev/zig/build/lib/zig/libc/include/generic-glibc -isystem /home/andy/dev/zig/build/lib/zig/libc/include/x86_64-linux-any -isystem /home/andy/dev/zig/build/lib/zig/libc/include/any-linux-any -march=native -g -fstack-protector-strong --param ssp-buffer-size=4 -fno-omit-frame-pointer -o .zig-cache/tmp/42zL6fBH8fSo-hello.o -c hello.c -fPIC +``` + +Note that if you run the command again, there is no output, and it finishes instantly: +``` +$ time zig build-exe hello.c -lc --verbose-cc + +real 0m0.027s +user 0m0.018s +sys 0m0.009s +``` + +This is thanks to [Build Artifact Caching](https://ziglang.org/download/0.4.0/release-notes.html#Build-Artifact-Caching). Zig automatically parses the .d file using a robust caching system to avoid duplicating work. + +Not only can Zig compile C code, but there is a very good reason to use Zig as a C compiler: [Zig ships with libc](#zig-ships-with-libc). + +### Export functions, variables, and types for C code to depend on + +One of the primary use cases for Zig is exporting a library with the C ABI for other programming languages to call into. The `export` keyword in front of functions, variables, and types causes them to be part of the library API: + +mathtest.zig +[]($code.language('=html').buildAsset('features/23-math-test.zig')) + +To make a static library: +``` +$ zig build-lib mathtest.zig +``` + +To make a shared library: +``` +$ zig build-lib mathtest.zig -dynamic +``` + +Here is an example with the [Zig Build System](#zig-build-system): + +test.c +```c +#include "mathtest.h" +#include + +int main(int argc, char **argv) { + int32_t result = add(42, 1337); + printf("%d\n", result); + return 0; +} +``` + +build.zig +[]($code.language('=html').buildAsset('features/24-build.zig')) + +``` +$ zig build test +1379 +``` + +## [Cross-compiling is a first-class use case]($heading.id('cross-compiling-is-a-first-class-use-case')) + +Zig can build for any of the targets from the Support Table (see latest release notes) with Tier 3 Support or better. No "cross toolchain" needs to be installed or anything like that. Here's a native Hello World: + +[]($code.language('=html').buildAsset('features/4-hello.zig')) + +Now to build it for x86_64-windows, x86_64-macos, and aarch64-linux: +``` +$ zig build-exe hello.zig -target x86_64-windows +$ file hello.exe +hello.exe: PE32+ executable (console) x86-64, for MS Windows +$ zig build-exe hello.zig -target x86_64-macos +$ file hello +hello: Mach-O 64-bit x86_64 executable, flags: +$ zig build-exe hello.zig -target aarch64-linux +$ file hello +hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, with debug_info, not stripped +``` + +This works on any Tier 3+ target, for any Tier 3+ target. + +### [Zig ships with libc]($heading.id('zig-ships-with-libc')) + +You can find the available libc targets with `zig targets`: +``` +... +.libc = .{ + "arc-linux-gnu", + "arm-freebsd-eabihf", + "arm-linux-gnueabi", + "arm-linux-gnueabihf", + "arm-linux-musleabi", + "arm-linux-musleabihf", + "arm-netbsd-eabi", + "arm-netbsd-eabihf", + "armeb-linux-gnueabi", + "armeb-linux-gnueabihf", + "armeb-linux-musleabi", + "armeb-linux-musleabihf", + "armeb-netbsd-eabi", + "armeb-netbsd-eabihf", + "thumb-linux-musleabi", + "thumb-linux-musleabihf", + "thumb-windows-gnu", + "thumbeb-linux-musleabi", + "thumbeb-linux-musleabihf", + "aarch64-freebsd-none", + "aarch64-linux-gnu", + "aarch64-linux-musl", + "aarch64-macos-none", + "aarch64-netbsd-none", + "aarch64-windows-gnu", + "aarch64_be-linux-gnu", + "aarch64_be-linux-musl", + "aarch64_be-netbsd-none", + "csky-linux-gnueabi", + "csky-linux-gnueabihf", + "hexagon-linux-musl", + "loongarch64-linux-gnu", + "loongarch64-linux-gnusf", + "loongarch64-linux-musl", + "loongarch64-linux-muslsf", + "m68k-linux-gnu", + "m68k-linux-musl", + "m68k-netbsd-none", + "mips-linux-gnueabi", + "mips-linux-gnueabihf", + "mips-linux-musleabi", + "mips-linux-musleabihf", + "mips-netbsd-eabi", + "mips-netbsd-eabihf", + "mipsel-linux-gnueabi", + "mipsel-linux-gnueabihf", + "mipsel-linux-musleabi", + "mipsel-linux-musleabihf", + "mipsel-netbsd-eabi", + "mipsel-netbsd-eabihf", + "mips64-linux-gnuabi64", + "mips64-linux-gnuabin32", + "mips64-linux-muslabi64", + "mips64-linux-muslabin32", + "mips64el-linux-gnuabi64", + "mips64el-linux-gnuabin32", + "mips64el-linux-muslabi64", + "mips64el-linux-muslabin32", + "powerpc-freebsd-eabihf", + "powerpc-linux-gnueabi", + "powerpc-linux-gnueabihf", + "powerpc-linux-musleabi", + "powerpc-linux-musleabihf", + "powerpc-netbsd-eabi", + "powerpc-netbsd-eabihf", + "powerpc64-freebsd-none", + "powerpc64-linux-gnu", + "powerpc64-linux-musl", + "powerpc64le-freebsd-none", + "powerpc64le-linux-gnu", + "powerpc64le-linux-musl", + "riscv32-linux-gnu", + "riscv32-linux-musl", + "riscv64-freebsd-none", + "riscv64-linux-gnu", + "riscv64-linux-musl", + "s390x-linux-gnu", + "s390x-linux-musl", + "sparc-linux-gnu", + "sparc-netbsd-none", + "sparc64-linux-gnu", + "sparc64-netbsd-none", + "wasm32-wasi-musl", + "x86-freebsd-none", + "x86-linux-gnu", + "x86-linux-musl", + "x86-netbsd-none", + "x86-windows-gnu", + "x86_64-freebsd-none", + "x86_64-linux-gnu", + "x86_64-linux-gnux32", + "x86_64-linux-musl", + "x86_64-linux-muslx32", + "x86_64-macos-none", + "x86_64-netbsd-none", + "x86_64-windows-gnu", +}, +... + ``` + +What this means is that `-lc` for these targets *does not depend on any system files*! + +Let's look at that [C hello world example](#zig-is-also-a-c-compiler) again: +``` +$ zig build-exe hello.c -lc +$ ./hello +Hello world +$ ldd ./hello + linux-vdso.so.1 (0x00007ffd03dc9000) + libc.so.6 => /lib/libc.so.6 (0x00007fc4b62be000) + libm.so.6 => /lib/libm.so.6 (0x00007fc4b5f29000) + libpthread.so.0 => /lib/libpthread.so.0 (0x00007fc4b5d0a000) + libdl.so.2 => /lib/libdl.so.2 (0x00007fc4b5b06000) + librt.so.1 => /lib/librt.so.1 (0x00007fc4b58fe000) + /lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007fc4b6672000) +``` + +[glibc](https://www.gnu.org/software/libc/) does not support building statically, but [musl](https://www.musl-libc.org/) does: +``` +$ zig build-exe hello.c -lc -target x86_64-linux-musl +$ ./hello +Hello world +$ ldd hello + not a dynamic executable +``` + +In this example, Zig built musl libc from source and then linked against it. The build of musl libc for x86_64-linux remains available thanks to the [caching system](https://ziglang.org/download/0.4.0/release-notes.html#Build-Artifact-Caching), so any time this libc is needed again it will be available instantly. + +This means that this functionality is available on any platform. Windows and macOS users can build Zig and C code, and link against libc, for any of the targets listed above. Similarly code can be cross compiled for other architectures: +``` +$ zig build-exe hello.c -lc -target aarch64-linux-gnu +$ file hello +hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 2.0.0, with debug_info, not stripped +``` + +In some ways, Zig is a better C compiler than C compilers! + +This functionality is more than bundling a cross-compilation toolchain along with Zig. For example, the total size of libc headers that Zig ships is 22 MiB uncompressed. Meanwhile, the headers for musl libc + linux headers on x86_64 alone are 8 MiB, and for glibc are 3.1 MiB (glibc is missing the linux headers), yet Zig currently ships with 40 libcs. With a naive bundling that would be 444 MiB. However, thanks to this [process_headers tool](https://github.com/ziglang/zig/blob/0.4.0/libc/process_headers.zig), and some [good old manual labor](https://github.com/ziglang/zig/wiki/Updating-libc), Zig binary tarballs remain roughly 30 MiB total, despite supporting libc for all these targets, as well as compiler-rt, libunwind, and libcxx, and despite being a clang-compatible C compiler. For comparison, the Windows binary build of clang 8.0.0 itself from llvm.org is 132 MiB. + +Note that only the Tier 1 Support targets have been thoroughly tested. It is planned to [add more libcs](https://github.com/ziglang/zig/issues/514) (including for Windows), and to [add test coverage for building against all the libcs](https://github.com/ziglang/zig/issues/2058). + +It's [planned to have a Zig Package Manager](https://github.com/ziglang/zig/issues/943), but it's not done yet. One of the things that will be possible is to create a package for C libraries. This will make the [Zig Build System](#zig-build-system) attractive for Zig programmers and C programmers alike. + +## [Zig Build System]($heading.id('zig-build-system')) + +Zig comes with a build system, so you don't need make, cmake, or anything like that. +``` +$ zig init +info: created build.zig +info: created build.zig.zon +info: created src/main.zig +info: created src/root.zig +info: see `zig build --help` for a menu of options +``` + +src/main.zig +[]($code.language('=html').buildAsset('features/25-all-bases.zig')) + + +build.zig +[]($code.language('=html').buildAsset('features/26-build.zig')) + + +Let's have a look at that `--help` menu. +``` +$ zig build --help +Usage: zig build [steps] [options] + +Steps: + install (default) Copy build artifacts to prefix path + uninstall Remove build artifacts from prefix path + run Run the app + test Run unit tests + +General Options: + -p, --prefix [path] Where to install files (default: zig-out) + --prefix-lib-dir [path] Where to install libraries + --prefix-exe-dir [path] Where to install executables + --prefix-include-dir [path] Where to install C header files + + --release[=mode] Request release mode, optionally specifying a + preferred optimization mode: fast, safe, small + + -fdarling, -fno-darling Integration with system-installed Darling to + execute macOS programs on Linux hosts + (default: no) + -fqemu, -fno-qemu Integration with system-installed QEMU to execute + foreign-architecture programs on Linux hosts + (default: no) + --glibc-runtimes [path] Enhances QEMU integration by providing glibc built + for multiple foreign architectures, allowing + execution of non-native programs that link with glibc. + -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on + ARM64 macOS hosts. (default: no) + -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to + execute WASI binaries. (default: no) + -fwine, -fno-wine Integration with system-installed Wine to execute + Windows programs on Linux hosts. (default: no) + + -h, --help Print this help and exit + -l, --list-steps Print available steps + --verbose Print commands before executing them + --color [auto|off|on] Enable or disable colored error messages + --prominent-compile-errors Buffer compile errors and display at end + --summary [mode] Control the printing of the build summary + all Print the build summary in its entirety + new Omit cached steps + failures (Default) Only print failed steps + none Do not print the build summary + -j Limit concurrent jobs (default is to use all CPU cores) + --maxrss Limit memory usage (default is to use available memory) + --skip-oom-steps Instead of failing, skip steps that would exceed --maxrss + --fetch Exit after fetching dependency tree + --watch Continuously rebuild when source files are modified + --fuzz Continuously search for unit test failures + --debounce Delay before rebuilding after changed file detected + -fincremental Enable incremental compilation + -fno-incremental Disable incremental compilation + +Project-Specific Options: + -Dtarget=[string] The CPU architecture, OS, and ABI to build for + -Dcpu=[string] Target CPU features to add or subtract + -Dofmt=[string] Target object format + -Ddynamic-linker=[string] Path to interpreter on the target system + -Doptimize=[enum] Prioritize performance, safety, or binary size + Supported Values: + Debug + ReleaseSafe + ReleaseFast + ReleaseSmall + +System Integration Options: + --search-prefix [path] Add a path to look for binaries, libraries, headers + --sysroot [path] Set the system root directory (usually /) + --libc [file] Provide a file which specifies libc paths + + --system [pkgdir] Disable package fetching; enable all integrations + -fsys=[name] Enable a system integration + -fno-sys=[name] Disable a system integration + + Available System Integrations: Enabled: + (none) - + +Advanced Options: + -freference-trace[=num] How many lines of reference trace should be shown per compile error + -fno-reference-trace Disable reference trace + -fallow-so-scripts Allows .so files to be GNU ld scripts + -fno-allow-so-scripts (default) .so files must be ELF files + --build-file [file] Override path to build.zig + --cache-dir [path] Override path to local Zig cache directory + --global-cache-dir [path] Override path to global Zig cache directory + --zig-lib-dir [arg] Override path to Zig lib directory + --build-runner [file] Override path to build runner + --seed [integer] For shuffling dependency traversal order (default: random) + --debug-log [scope] Enable debugging the compiler + --debug-pkg-config Fail if unknown pkg-config flags encountered + --debug-rt Debug compiler runtime libraries + --verbose-link Enable compiler debug output for linking + --verbose-air Enable compiler debug output for Zig AIR + --verbose-llvm-ir[=file] Enable compiler debug output for LLVM IR + --verbose-llvm-bc=[file] Enable compiler debug output for LLVM BC + --verbose-cimport Enable compiler debug output for C imports + --verbose-cc Enable compiler debug output for C compilation + --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features +``` + +You can see that one of the available steps is run. +``` +$ zig build run +All your codebase are belong to us. +Run `zig build test` to run the tests. +``` + +Here are some example build scripts: + +- [Build script of OpenGL Tetris game](https://github.com/andrewrk/tetris/blob/master/build.zig) +- [Build script of bare metal Raspberry Pi 3 arcade game](https://github.com/andrewrk/clashos/blob/master/build.zig) +- [Build script of self-hosted Zig compiler](https://github.com/ziglang/zig/blob/master/build.zig) + +## Wide range of targets supported + +Zig uses a "support tier" system to communicate the level of support for different targets. + +[Support Table as of Zig 0.15](https://ziglang.org/download/0.15.1/release-notes.html#Target-Support) + +## Friendly toward package maintainers + +Even though Zig is self-hosted, building from source only depends on system +C/C++ toolchain and LLVM, using standard CMake build steps thanks to +[a WebAssembly based bootstrap process](https://ziglang.org/news/goodbye-cpp/). + +For those distributions that want to avoid binary blobs, there is a +well-documented set of steps to +[reproduce Zig without binaries](https://jakstys.lt/2024/zig-reproduced-without-binaries/). + +In the future, we hope to inspire a third party to implement a Zig interpreter +written in C that can reduce this to O(1) step. + +As Maya Rashish notes, +[porting Zig to other platforms is fun and speedy](http://coypu.sdf.org/porting-zig.html). + +Non-debug [build modes](https://ziglang.org/documentation/master/#Build-Mode) are reproducible/deterministic. + +There is a [JSON version of the download page](https://ziglang.org/download/index.json). diff --git a/content/ca-ES/learn/samples.smd b/content/ca-ES/learn/samples.smd new file mode 100644 index 000000000..580c2e73e --- /dev/null +++ b/content/ca-ES/learn/samples.smd @@ -0,0 +1,48 @@ +--- +.title = "Samples", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Samples", + "toc": true, +}, +--- + +# [Hello world]($heading.id('hello')) +A minimal example printing hello world. + +[]($code.language('=html').buildAsset("samples/hello-world.zig")) + +# [Calling external library functions]($heading.id('ext')) +All system API functions can be invoked this way, you do not need library bindings to interface them. + +[]($code.language('=html').buildAsset("samples/windows-msgbox.zig")) + +# [Memory leak detection]($heading.id('leak')) +Using `std.heap.GeneralPurposeAllocator` you can track double frees and memory leaks. + +[]($code.language('=html').buildAsset("samples/memory-leak.zig")) + + +# [C interoperability]($heading.id('c-interop')) +Example of importing a C header file and linking to both libc and raylib. + +[]($code.language('=html').buildAsset("samples/c-interop.zig")) + + +# [Zigg Zagg]($heading.id('zigg-zagg')) +Zig is *optimized* for coding interviews (not really). + +[]($code.language('=html').buildAsset("samples/ziggzagg.zig")) + + +# [Generic Types]($heading.id('generic')) +In Zig types are comptime values and we use functions that return a type to implement generic algorithms and data structures. In this example we implement a simple generic queue and test its behaviour. + +[]($code.language('=html').buildAsset("samples/generic-type.zig")) + + +# [Using cURL from Zig]($heading.id('curl')) + +[]($code.language('=html').buildAsset("samples/curl.zig")) diff --git a/content/ca-ES/learn/tools.smd b/content/ca-ES/learn/tools.smd new file mode 100644 index 000000000..c55a1ed87 --- /dev/null +++ b/content/ca-ES/learn/tools.smd @@ -0,0 +1,41 @@ +--- +.title = "Tools", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Tools", + "toc": true, +}, +--- + +# [Language Servers]($heading.id('lsp')) +Language servers are editor-agnostic tools for obtaining syntax highlighting, autocompletion, and many other features. Consider using a Language server over a syntax-highlighting extension for a richer development experience. + +- [zigtools/zls](https://github.com/zigtools/zls) + +# [Text Editors]($heading.id('editors')) +Editor-specific tools, mostly syntax highlighters. + +## VS Code +- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) + +## Visual Studio +- [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) + +## Sublime Text +- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) + +## Vim +- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) + +## Emacs +- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) + +## Kate +- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) + +## JetBrains family (IntelliJ IDEA, Fleet) +- [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) +- [Zig Fleet Plugin](https://plugins.jetbrains.com/plugin/26070-zig) + diff --git a/content/ca-ES/learn/why_zig_rust_d_cpp.smd b/content/ca-ES/learn/why_zig_rust_d_cpp.smd new file mode 100644 index 000000000..98b9066cb --- /dev/null +++ b/content/ca-ES/learn/why_zig_rust_d_cpp.smd @@ -0,0 +1,158 @@ +--- +.title = "Why Zig When There is Already C++, D, and Rust?", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Why Zig?", +}, +--- + +# No hidden control flow + +If Zig code doesn't look like it's jumping away to call a function, then it isn't. This means you can be sure that the following code calls only `foo()` and then `bar()`, and this is guaranteed without needing to know the types of anything: + +```zig +var a = b + c.d; +foo(); +bar(); +``` + +Examples of hidden control flow: + +* D has `@property` functions, which are methods that you call with what looks like field access, so in the above example, `c.d` might call a function. +* C++, D, and Rust have operator overloading, so the `+` operator might call a function. +* C++, D, and Go have throw/catch exceptions (sometimes also called panic/recover), so `foo()` might throw an exception, and prevent `bar()` from being called. (Of course, even in Zig `foo()` could deadlock and prevent `bar()` from being called, but that can happen in any Turing-complete language.) + +The purpose of this design decision is to improve readability. + +# No hidden allocations + +Zig has a hands-off approach when it comes to heap allocation. There is no `new` keyword +or any other language feature that uses a heap allocator (e.g. string concatenation operator[1]). +The entire concept of the heap is managed by library and application code, not by the language. + +Examples of hidden allocations: + +* Go's `defer` allocates memory to a function-local stack. In addition to being an unintuitive + way for this control flow to work, it can cause out-of-memory failures if you use + `defer` inside a loop. +* C++ coroutines allocate heap memory in order to call a coroutine. +* In Go, a function call can cause heap allocation because goroutines allocate small stacks + that get resized when the call stack gets deep enough. +* The main Rust standard library APIs panic on out of memory conditions, and the alternate + APIs that accept allocator parameters are an afterthought + (see [rust-lang/rust#29802](https://github.com/rust-lang/rust/issues/29802)). + +Nearly all garbage collected languages have hidden allocations strewn about, since the +garbage collector hides the evidence on the cleanup side. + +The main problem with hidden allocations is that it prevents the *reusability* of a +piece of code, unnecessarily limiting the number of environments that code would be +appropriate to be deployed to. Simply put, there are use cases where one must be able +to rely on control flow and function calls not to have the side-effect of memory allocation, +therefore a programming language can only serve these use cases if it can realistically +provide this guarantee. + +In Zig, there are standard library features that provide and work with heap allocators, +but those are optional standard library features, not built into the language itself. +If you never initialize a heap allocator, you can be confident your program will not heap allocate. + +Every standard library feature that needs to allocate heap memory accepts an `Allocator` parameter +in order to do it. This means that the Zig standard library supports freestanding targets. For +example `std.ArrayList` and `std.AutoHashMap` can be used for bare metal programming! + +Custom allocators make manual memory management a breeze. Zig has a debug allocator that +maintains memory safety in the face of use-after-free and double-free. It automatically +detects and prints stack traces of memory leaks. There is an arena allocator so that you can +bundle any number of allocations into one and free them all at once rather than manage +each allocation independently. Special-purpose allocators can be used to improve performance +or memory usage for any particular application's needs. + +[1]: Actually there is a string concatenation operator (generally an array concatenation operator), but it only works at compile time, so it still doesn't do any runtime heap allocation. + +# First-class support for no standard library + +As hinted above, Zig has an entirely optional standard library. Each std lib API only gets compiled +into your program if you use it. Zig has equal support for either linking against libc or +not linking against it. Zig is friendly to bare-metal and high-performance development. + +It's the best of both worlds; for example in Zig, WebAssembly programs can both use +the normal features of the standard library, and still result in the tiniest binaries when +compared to other programming languages that support compiling to WebAssembly. + +# A Portable Language for Libraries + +One of the holy grails of programming is code reuse. Sadly, in practice, we find ourselves re-inventing the wheel many times over again. Often it's justified. + + * If an application has real-time requirements, then any library that uses garbage collection or any other non-deterministic behavior is disqualified as a dependency. + * If a language makes it too easy to ignore errors, and thus hard to verify that a library correctly handles and bubbles up errors, it can be tempting to ignore the library and re-implement it, knowing that one handled all the relevant errors correctly. Zig is designed such that the laziest thing a programmer can do is handle errors correctly, and thus one can be reasonably confident that a library will properly bubble errors up. + * Currently it is pragmatically true that C is the most versatile and portable language. Any language that does not have the ability to interact with C code risks obscurity. Zig is attempting to become the new portable language for libraries by simultaneously making it straightforward to conform to the C ABI for external functions, and introducing safety and language design that prevents common bugs within the implementations. + +# A Package Manager and Build System for Existing Projects + +Zig is a toolchain in addition to a programming language. It comes with a +[build system and package manager](/learn/build-system/) that are useful even +in the context of a traditional C/C++ project. + +Not only can you write Zig code instead of C or C++ code, but you can use Zig +as a replacement for autotools, cmake, make, scons, ninja, etc. And on top of +this, it provides a package manager for native dependencies. This build system +is appropriate even if the entirety of a project's codebase is in C or C++. +For example, by +[porting ffmpeg to the zig build system](https://github.com/andrewrk/ffmpeg), +it becomes possible to compile ffmpeg on any supported system for any supported +system using only a [50 MiB download of zig](/download/). For open source +projects, this streamlined ability to build from source - and even +cross-compile - can be the difference between gaining or losing valuable +contributors. + +System package managers such as apt-get, pacman, homebrew, and others are +instrumental for end user experience, but they can be insufficient for the +needs of developers. A language-specific package manager can be the difference +between having no contributors and having many. For open source projects, the +difficulty of getting the project to build at all is a huge hurdle for +potential contributors. For C/C++ projects, having dependencies can be fatal, +especially on Windows, where there is no package manager. Even when just +building Zig itself, most potential contributors have a difficult time with the +LLVM dependency. Zig offers a way for projects to depend on native libraries +directly - without depending on the users' system package manager to have the +correct version available, and in a way that is practically guaranteed to +successfully build projects on the first try regardless of what system is being +used and independent of what platform is being targeted. + +**Other languages have package managers but they do not eliminate pesky system +dependencies like Zig does.** + +Zig can replace a project's build system with a reasonable language using +a declarative API for building projects, that also provides package management, +and thus the ability to actually depend on other C libraries. The ability to +have dependencies enables higher level abstractions, and thus the proliferation +of reusable high-level code. + +# Simplicity + +C++, Rust, and D have such a large number of features that they can be distracting from the actual meaning of the application you are working on. One finds oneself debugging one's knowledge of the programming language instead of debugging the application itself. + +Zig has no macros yet is still powerful enough to express complex programs in a +clear, non-repetitive way. Even Rust has macros with special cases like +`format!`, which is implemented in the compiler itself. Meanwhile in Zig, the +equivalent function is implemented in the standard library with no special case +code in the compiler. + +# Tooling + +Zig can be downloaded from [the downloads section](/download/). Zig provides +binary archives for Linux, Windows, and macOS. The following describes what you +get with one of these archives: + +* installed by downloading and extracting a single archive, no system configuration needed +* statically compiled so there are no runtime dependencies +* supports using LLVM for optimized release builds while using Zig's custom backends for faster compilation performance +* additionally supports a backend for outputting C code +* out of the box cross-compilation to most major platforms +* ships with source code for libc that will be dynamically compiled when needed for any supported platform +* includes build system with concurrency and caching +* compiles C and C++ code with libc support +* drop-in GCC/Clang command line compatibility with `zig cc` +* Windows resource compiler diff --git a/content/ca-ES/zsf.smd b/content/ca-ES/zsf.smd new file mode 100644 index 000000000..8316e143a --- /dev/null +++ b/content/ca-ES/zsf.smd @@ -0,0 +1,86 @@ +--- +.title = "Zig Software Foundation", +.author = "", +.date = @date("2024-08-07:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "ZSF", +}, +--- +# Sponsoring the Zig Software Foundation + +Please consider a recurring donation. It takes ongoing labor to maintain and support high-quality software! + +```=html +
+ + Donate + +
+``` + + +# Mission statement +The mission of the Zig Software Foundation is to promote, protect, and advance the Zig programming language, to support and facilitate the growth of a diverse and international community of Zig programmers, and to provide education and guidance to students, teaching the next generation of programmers to be competent, ethical, and to hold each other to high standards. + +**ZSF is a 501(c)(3) non-profit corporation.** Finances, meeting minutes, and other details are [available to the public](https://drive.google.com/drive/folders/1ucHARxVbhrBbuZDbhrGHYDTsYAs8_bMH?usp=sharing). + +# Board members + +- [Andrew Kelley](https://andrewkelley.me/) (President) +- [Josh Wolfe](https://github.com/thejoshwolfe/) (Secretary) +- [Mason Remaley](https://www.masonremaley.com/) (Treasurer) + +# Sponsorship + +By donating to ZSF, you are funding development of the Zig Programming Language and its ecosystem, which in turn benefits the greater open source community. Zig community members have landed bug fixes in [LLVM](https://llvm.org/), [Wine](https://winehq.org/), [QEMU](https://qemu.org/), [musl libc](https://musl.libc.org/), [GDB](https://www.gnu.org/software/gdb/) and others. + +ZSF is a small organization and makes efficient use of monetary resources. The plan is to keep it that way, but we do want to turn our unpaid volunteers into paid maintainers to help merge pull requests and make swifter progress towards 1.0. The whole point of ZSF being non-profit is to benefit people. We're trying to get open source maintainers paid for their time. + +# Donation information +Here's useful information to donate through means other than GitHub Sponsors. +Make sure to check your local law to see if you can deduct donations from your taxes. + +## EIN +84-5105214 + +## Address +Zig Software Foundation +1632 1st Ave #21385 +New York, NY 10028 + +## Additional donation methods supported +- [Every](https://www.every.org/zig-software-foundation-inc/) +- [GitHub Sponsors](https://github.com/sponsors/ziglang) +- [Benevity](https://benevity.com) (recommended if your employer matches donations!) +- Bank transfers (including from outside of the US, contact us for more info) +- Physical checks (see the snail mail address listed above) +- [Wise](https://wise.com) + +**Please don't hesitate to contact us at donations@ziglang.org if you have questions or specific needs.** + +# Corporate sponsors + +## Monetary donations +The following companies are providing direct financial support to the Zig Software foundation by donating more than $1000/mo. +[]($code.language('=html').siteAsset('corporate-sponsors.html')) diff --git a/i18n/ca-ES.ziggy b/i18n/ca-ES.ziggy new file mode 100644 index 000000000..291cd8f32 --- /dev/null +++ b/i18n/ca-ES.ziggy @@ -0,0 +1,28 @@ +.back = "← Back to", +// index.shtml +.community = "Join a Community", +.source = "Source", +.get_started = "GET STARTED", +.latest_release = "Latest Release:", +.documentation = "Documentation", +.changes = "Changes", +.overview = "Full overview", +.code_samples = "More code samples", +.all_communities = "See all Communities", +.learn_more = "Learn More", +.github_sponsors_update_frequency = "This section is updated daily.", +// learn.shtml +.version_unstable = "Unstable", +.version_latest_stable = "Latest Stable", +// download.shtml +.release_notes = "Release Notes", +.language_reference = "Language Reference", +.std_docs = "Standard Library Documentation", +.download_source = "Source", +.download_os = "OS", +.download_arch = "Arch", +.download_filename = "Filename", +.download_sig = "Signature", +.download_size = "Size", +// locale.shtml +.languages_menu = "This page is also available in the following languages:", diff --git a/zine.ziggy b/zine.ziggy index ce7af42c7..57879bf3a 100644 --- a/zine.ziggy +++ b/zine.ziggy @@ -42,6 +42,12 @@ Multilingual { .content_dir_path = "content/en-US", .output_prefix_override = "", }, + { + .code = "ca-ES", + .name = "Català", + .site_title = "Zig Programming Language", + .content_dir_path = "content/ca-ES", + }, { .code = "es-AR", .name = "Español", From a05081537d20e5d4215d547f151518d9341e29f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Thu, 20 Nov 2025 21:28:29 +0900 Subject: [PATCH 2/8] i18n: translate ca-ES.ziggy --- i18n/ca-ES.ziggy | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/i18n/ca-ES.ziggy b/i18n/ca-ES.ziggy index 291cd8f32..72a70f848 100644 --- a/i18n/ca-ES.ziggy +++ b/i18n/ca-ES.ziggy @@ -1,28 +1,28 @@ -.back = "← Back to", +.back = "← Torna a", // index.shtml -.community = "Join a Community", -.source = "Source", -.get_started = "GET STARTED", -.latest_release = "Latest Release:", -.documentation = "Documentation", -.changes = "Changes", -.overview = "Full overview", -.code_samples = "More code samples", -.all_communities = "See all Communities", -.learn_more = "Learn More", -.github_sponsors_update_frequency = "This section is updated daily.", +.community = "Uneix-te a la comunitat", +.source = "Codi font", +.get_started = "COMENÇA", +.latest_release = "Darrera versió:", +.documentation = "Documentació", +.changes = "Canvis", +.overview = "Visió general", +.code_samples = "Més exemples de codi", +.all_communities = "Mostra totes les comunitats", +.learn_more = "Més informació", +.github_sponsors_update_frequency = "Aquesta secció s'actualitza diàriament.", // learn.shtml -.version_unstable = "Unstable", -.version_latest_stable = "Latest Stable", +.version_unstable = "Inestable", +.version_latest_stable = "Darrera versió estable", // download.shtml -.release_notes = "Release Notes", -.language_reference = "Language Reference", -.std_docs = "Standard Library Documentation", -.download_source = "Source", -.download_os = "OS", -.download_arch = "Arch", -.download_filename = "Filename", -.download_sig = "Signature", -.download_size = "Size", +.release_notes = "Notes de la versió", +.language_reference = "Referència del llenguatge", +.std_docs = "Documentació de la biblioteca estàndard", +.download_source = "Codi font", +.download_os = "SO", +.download_arch = "Arquitectura", +.download_filename = "Nom del fitxer", +.download_sig = "Signatura", +.download_size = "Mida", // locale.shtml -.languages_menu = "This page is also available in the following languages:", +.languages_menu = "Aquesta pàgina també està disponible en els següents idiomes:", From 7993d72ba1a77a6fbc6c363f3772ecc32031969a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Fri, 21 Nov 2025 22:53:35 +0900 Subject: [PATCH 3/8] i18n: translate the rest of the site --- content/ca-ES/download.smd | 16 +- content/ca-ES/download/community-mirrors.smd | 97 +++--- content/ca-ES/index.smd | 66 ++-- content/ca-ES/learn/build-system.smd | 324 +++++++++---------- content/ca-ES/learn/getting-started.smd | 112 ++++--- content/ca-ES/learn/index.smd | 76 ++--- content/ca-ES/learn/overview.smd | 257 ++++++++------- content/ca-ES/learn/samples.smd | 28 +- content/ca-ES/learn/tools.smd | 14 +- content/ca-ES/learn/why_zig_rust_d_cpp.smd | 290 +++++++++-------- content/ca-ES/zsf.smd | 44 ++- 11 files changed, 637 insertions(+), 687 deletions(-) diff --git a/content/ca-ES/download.smd b/content/ca-ES/download.smd index bc6199e23..0a66d955d 100644 --- a/content/ca-ES/download.smd +++ b/content/ca-ES/download.smd @@ -1,23 +1,23 @@ --- -.title = "Download", +.title = "Descàrregues", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "download.shtml", .custom = { - "mobile_menu_title": "Download", + "mobile_menu_title": "Descàrregues", "OSs": ["Windows", "macOS", "Linux", "FreeBSD", "NetBSD"], }, --- -# Releases -You can also [install Zig from a package manager](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager). +# Versions +També podeu [instal·lar Zig des d'un gestor de paquets](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager). -There is a [JSON version of this page]($link.siteAsset('download/index.json')). +Hi ha una [versió JSON d'aquesta pàgina]($link.siteAsset('download/index.json')). -Files are signed with [minisign](https://jedisct1.github.io/minisign/) using this public key: +Els fitxers estan signats amb [minisign](https://jedisct1.github.io/minisign/) utilitzant aquesta clau pública: ``` RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U ``` -> # [Setting up an automation?]($block) -> If you're automating the process of downloading Zig, you might want to learn about [Community Mirrors](/download/community-mirrors) to avoid downtime and help us save on bandwidth costs. +> # [Preparant una automatització?]($block) +> Si esteu automatitzant el procés de descàrrega de Zig, potser vulgueu aprendre sobre els [Webs Mirall de la Comunitat](https://ziglang.org/download/community-mirrors) per evitar temps d'inactivitat i ajudar-nos a estalviar costos d'ample de banda. diff --git a/content/ca-ES/download/community-mirrors.smd b/content/ca-ES/download/community-mirrors.smd index 0d3f2c4e9..43d56be3e 100644 --- a/content/ca-ES/download/community-mirrors.smd +++ b/content/ca-ES/download/community-mirrors.smd @@ -1,5 +1,5 @@ --- -.title = "Community Mirrors", +.title = "Webs Mirall de la Comunitat", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "download/community-mirrors.shtml", @@ -8,85 +8,68 @@ .layout = "download/community-mirrors-list.shtml", .output = "/download/community-mirrors.txt", }], -.custom = { "mobile_menu_title": "Mirrors" }, +.custom = { "mobile_menu_title": "Webs Mirall" }, --- -If you're setting something up which will automatically download Zig, like CI, you might be interested in using community mirrors instead of downloading from -ziglang.org. +Si esteu configurant alguna cosa que descarregarà Zig automàticament, com ara la integració contínua (CI), potser us interessa utilitzar webs mirall de la comunitat en lloc de descarregar-lo de ziglang.org. -The ziglang.org website does not offer any uptime or speed guarantees, meaning that your CI will sporadically fail or have slower runs if it hardcodes it as a -download URL. In fact, configuring your CI to fetch from ziglang.org directly contributes to uptime and speed issues, because this site is [intentionally hosted -on a simple one-computer configuration](https://ziglang.org/news/migrate-to-self-hosting). Instead, it is often a good idea to fetch Zig from one of many community-maintained -mirrors. These mirrors are not officially endorsed by the Zig Software Foundation, but they can be used without security risks thanks to our signing of -archives. While no individual mirror has an uptime or speed guarantee, configuring your automation to cycle through the list of available mirrors can -effectively guarantee high uptime in practice. +El lloc web ziglang.org no ofereix cap garantia de temps d'activitat o velocitat, la qual cosa significa que la vostra CI pot fallar esporàdicament o tenir execucions més lentes si l'utilitzeru com a URL de descàrrega. De fet, configurar la vostra CI per descarregar directament de ziglang.org contribueix a problemes de temps d'activitat i velocitat, perquè aquest lloc està [intencionadament allotjat en una configuració senzilla d'un sol ordinador](https://ziglang.org/news/migrate-to-self-hosting). En canvi, és sovint una bona idea obtenir Zig d'un dels diversos webs mirall mantinguts per la comunitat. Aquests webs mirall no estan oficialment avalats per la Zig Software Foundation, però es poden utilitzar sense riscos de seguretat gràcies a la nostra signatura dels arxius. Tot i que cap web mirall individual té una garantia de temps d'activitat o velocitat, configurar la vostra automatització per recórrer la llista de webs mirall disponibles pot garantir de manera efectiva un alt temps d'activitat a la pràctica. -> # [Security Notice]($block) -> Community mirrors are not officially trusted or endorsed by the Zig Software Foundation, and could in theory serve malicious binaries. If you are using them, -> you **must** make sure to validate the minisign signature for every tarball you download against the ZSF's public key, available on [the download -> page](/download). +> # [Avís de seguretat]($block) +> Els webs mirall de la comunitat no són oficialment de confiança ni estan avalats per la Zig Software Foundation, i en teoria podrien oferir binaris maliciosos. Si els utilitzeu, **heu** d'assegurar-vos de validar la signatura minisign de cada tarball que descarregueu amb la clau pública de la ZSF, disponible a [la pàgina de descàrrega](/download). -## GitHub Actions +## Accions de GitHub -If you are setting up an automation using GitHub Actions, you may be interested in the -[mlugg/setup-zig](https://github.com/marketplace/actions/setup-zig-compiler) Action (note that this is not an official ZSF project). Not only does it install a -Zig version of your choice from a community mirror, but it also saves your Zig cache directory between workflow runs, allowing for faster rebuilds. +Si esteu configurant una automatització utilitzant GitHub Actions, potser us interessa l'acció [mlugg/setup-zig](https://github.com/marketplace/actions/setup-zig-compiler) (teniu en compte que aquest no és un projecte oficial de la ZSF). No només instal·la una versió de Zig de la vostra elecció des d'un web mirall de la comunitat, sinó que també guarda el directori de la vostra memòria cau de Zig entre les execucions del flux de treball, permetent compilacions més ràpides. -## Using Mirrors +## Utilitzant Webs Mirall -The list of community mirrors is available in a newline-separated ASCII text file at https://ziglang.org/download/community-mirrors.txt. Tooling is recommended -to fetch this list and try mirrors in a randomized order (to avoid putting excessive load on any one mirror, as this slows it down for everyone). +La llista dels webs mirall de la comunitat està disponible en un fitxer de text ASCII separat per salts de línia a https://ziglang.org/download/community-mirrors.txt. Es recomana que les eines obtinguin aquesta llista i proveu els webs mirall en un ordre aleatori (per evitar carregar excessivament un sol web mirall, ja que això el faria més lent per a tothom). -Every Zig tarball is associated with a [minisign](https://jedisct1.github.io/minisign/) signature file, which can also be downloaded from mirrors. **When you -download a tarball from a mirror, you must also download its associated signature and verify the tarball against it.** Failing to check the signature could -theoretically leave you vulnerable to malicious mirrors hosting modified tarballs. +Cada tarball de Zig s'associa amb un fitxer de signatura [minisign](https://jedisct1.github.io/minisign/), que també es pot descarregar dels webs mirall. **Quan descarregueu un tarball d'un web mirall, també heu de descarregar la seva signatura associada i verificar el tarball amb ella.** Si no es verifica la signatura, teòricament podríeu quedar vulnerables a webs mirall maliciosos que allotgin tarballs modificats. -Put simply, the recommended strategy is approximately this pseudocode: +En poques paraules, l'estratègia recomanada és aproximadament aquest pseudocodi: ```python -pubkey = "(copy this from https://ziglang.org/download)" +pubkey = "(copia això de https://ziglang.org/download)" tarball_name = "zig-x86_64-linux-0.14.1.tar.xz" -# To improve uptime, optionally cache this GET: +# Per millorar el temps d'activitat, opcionalment, desa aquesta petició GET: mirrors = http_get("https://ziglang.org/download/community-mirrors.txt") -# ASCII-encoded, one mirror per line, newlines are LF, there is a trailing newline. +# Codificat en ASCII, un mirall per línia, els salts de línia són LF, hi ha un salt de línia al final. shuffled = shuffle_lines(mirrors) for mirror_url in shuffled: tarball = http_get(f"{mirror_url}/{tarball_name}?source=my_automation_name") if success: - # NEVER SKIP THIS STEP. The signature must be verified before the tarball is deemed safe. + # MAI OMETIS AQUEST PAS. La signatura s'ha de verificar abans que el tarball es consideri segur. signature = http_get(f"{mirror_url}/{tarball_name}.minisig?source=my_automation_name") if success and minisign_verify(tarball, signature, pubkey): - print("Successfully fetched Zig 0.14.1!") + print("Zig 0.14.1 descarregat amb èxit!") ``` -Because ziglang.org does not have guaranteed uptime, the `community-mirrors.txt` file may at times become inaccessible. For this reason, you may wish to -consider caching its contents to prevent disruption in the event that ziglang.org encounters downtime. The recommended refetch interval is approximately -once per day. At this point in time, mirrors may be added or removed on a monthly basis as the ecosystem evolves, so periodic re-fetching is essential. +Com que ziglang.org no té un temps d'activitat garantit, el fitxer `community-mirrors.txt` pot, de vegades, ser inaccessible. Per aquesta raó, potser voldreu considerar la possibilitat de guardar-ne el contingut a la memòria cau per evitar interrupcions en cas que ziglang.org experimenti temps d'inactivitat. L'interval de recuperació recomanat és aproximadament una vegada al dia. En aquest moment, els webs mirall es poden afegir o eliminar mensualment a mesura que l'ecosistema evoluciona, per la qual cosa la recuperació periòdica és essencial. -Written more precisely, here is the key information and recommend workflow for downloading Zig tarballs: +Escrit de manera més precisa, aquí hi ha la informació clau i el flux de treball recomanat per descarregar tarballs de Zig: -* The mirror list file is available at https://ziglang.org/download/community-mirrors.txt. - * Because ziglang.org does not guarantee uptime, it may be desirable to cache this file. -* The mirror list file contains ASCII-encoded mirror URLs, separated with newline characters (ASCII LF 0x20). There is a trailing newline. There is no other whitespace. There are no blank lines. -* Mirrors are required to support HTTPS. Every line in the mirror list file begins with "https://". -* Mirrors cannot guarantee uptime, so if one fails to serve you a tarball, you should try another. Ideally, shuffle the list, and try each mirror in turn. - * Usually, the first one will work. If no mirror works, you may choose to try `ziglang.org` as a final fallback. -* To download a tarball from a mirror, perform a GET request to "mirror/filename", where "mirror" is the mirror URL, and "filename" is the basename of the corresponding tarball on ziglang.org (e.g. `zig-x86_64-linux-0.14.1.tar.xz`). - * You are highly encouraged to include in your request a query parameter named `source` containing a string indicating what is making this request. For instance, the `mlugg/setup-zig` GitHub Action passes it as `?source=github-mlugg-setup-zig`. - * Source tarballs, bootstrap tarballs, and binary tarballs are available from all listed mirrors, as well as minisign signatures for all such files. - * Binary tarballs for recent Zig versions are of the form `zig-x86_64-linux-0.14.1.tar.xz`. - * If a mirror responds with a HTTP status code other than 200 OK: - * `503 Unavailable` may indicate scheduled downtime. - * `429 Too Many Requests` may indicate intentional rate-limiting. - * `404 Not Found` is a permitted response when requesting Zig releases 0.5.0 or earlier, or Zig development builds earlier than the current latest release. - * `504 Gateway Timeout` indicates that the tarball is unavailable because `https://ziglang.org/` is currently inaccessible (and the tarball is not in the mirror's cache). - * Otherwise, feel free to [open an issue](https://github.com/ziglang/www.ziglang.org/issues/new) to inform us of the problem. -* The Zig Software Foundation can never guarantee the security of any mirror, so every time a tarball is downloaded, it is **essential** to also download the minisign signature (suffix the filename with ".minisig") and verify it against the ZSF's public key (which you should copy from the ziglang.org/download page). **Never skip this step.** - * If a mirror responds with `200 OK` but signature validation fails on the returned tarball, feel free to [open an issue](https://github.com/ziglang/www.ziglang.org/issues/new) to inform us of the problem. -* When the minisig signature is verified, it is also necessary to validate its **trusted comment** (which the reference implementation `minisign` always does), and ensure that its "file" field matches the name of the requested tarball, to prevent downgrade attacks. +* El fitxer de la llista dels webs mirall està disponible a https://ziglang.org/download/community-mirrors.txt. + * Com que ziglang.org no garanteix el temps d'activitat, pot ser desitjable emmagatzemar aquest fitxer a la memòria cau. +* El fitxer de la llista dels webs mirall conté URL dels webs mirall codificats en ASCII, separats per caràcters de nova línia (ASCII LF 0x20). Hi ha una nova línia al final. No hi ha altres espais en blanc. No hi ha línies en blanc. +* Els webs mirall han de suportar HTTPS. Cada línia del fitxer de la llista dels webs mirall comença amb "https://". +* Els webs mirall no poden garantir el temps d'activitat, així que si un no us pot proporcionar un tarball, hauríeu de provar-ne un altre. Idealment, barregeu la llista i proveu cada web mirall al seu torn. + * Normalment, el primer funcionarà. Si cap web mirall funciona, podeu optar per provar `ziglang.org` com a darrera opció. +* Per descarregar un tarball d'un web mirall, realitzeu una petició GET a "mirall/nom_fitxer", on "mirall" és l'URL de la web mirall, i "nom_fitxer" és el nom base del tarball corresponent a ziglang.org (per exemple, `zig-x86_64-linux-0.14.1.tar.xz`). + * Us recomanem encaridament que inclogueu a la vostra petició un paràmetre de consulta anomenat `source` que contingui una cadena que indiqui què està fent aquesta petició. Per exemple, l'acció de GitHub `mlugg/setup-zig` el passa com a `?source=github-mlugg-setup-zig`. + * Els tarballs de codi font, els tarballs d'arrencada i els tarballs binaris estan disponibles en tots els webs mirall llistats, així com les signatures minisign per a tots aquests fitxers. + * Els tarballs binaris per a versions recents de Zig tenen el format `zig-x86_64-linux-0.14.1.tar.xz`. + * Si un web mirall respon amb un codi d'estat HTTP diferent de 200 OK: + * `503 Unavailable` pot indicar un temps d'inactivitat programat. + * `429 Too Many Requests` pot indicar una limitació de taxa intencional. + * `404 Not Found` és una resposta permesa en sol·licitar versions de Zig 0.5.0 o anteriors, o versions de desenvolupament de Zig anteriors a la darrera versió actual. + * `504 Gateway Timeout` indica que el tarball no està disponible perquè `https://ziglang.org/` és actualment inaccessible (i el tarball no està a la memòria cau del web mirall). + * En cas contrari, no dubteu a [obrir una incidència](https://github.com/ziglang/www.ziglang.org/issues/new) per informar-nos del problema. +* La Zig Software Foundation mai pot garantir la seguretat de cap web mirall, així que cada vegada que es descarrega un tarball, és **essencial** descarregar també la signatura minisign (afegeix el sufix ".minisig" al nom del fitxer) i verificar-la amb la clau pública de la ZSF (que hauríeu de copiar de la pàgina ziglang.org/download). **Mai ometeu aquest pas.** + * Si un web mirall respon amb `200 OK` però la validació de la signatura falla amb el tarball retornat, no dubtis a [obrir una incidència](https://github.com/ziglang/www.ziglang.org/issues/new) per informar-nos del problema. +* Quan es verifica la signatura minisig, també és necessari validar el seu **comentari de confiança** (cosa que la implementació de referència `minisign` sempre fa), i assegurar-se que el seu camp "file" coincideix amb el nom del tarball sol·licitat, per prevenir atacs de downgrade. -## Hosting a Mirror +## Allotjament d'un Web Mirall -If you are interested in hosting a mirror, please consult the [documentation in the www.ziglang.org -repository](https://github.com/ziglang/www.ziglang.org/blob/main/MIRRORS.md). Thank you for helping -to improve and decentralize the Zig ecosystem! +Si us interessa allotjar un web mirall, consulteu la [documentació del repositori www.ziglang.org](https://github.com/ziglang/www.ziglang.org/blob/main/MIRRORS.md). Gràcies per ajudar a millorar i descentralitzar l'ecosistema Zig! diff --git a/content/ca-ES/index.smd b/content/ca-ES/index.smd index 374921529..318de3e06 100644 --- a/content/ca-ES/index.smd +++ b/content/ca-ES/index.smd @@ -1,64 +1,64 @@ --- -.title = "Home", +.title = "Inici", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "index.shtml", .custom = { - "mobile_menu_title": "Home", + "mobile_menu_title": "Inici", }, --- []($section.id("slogan")) -Zig is a general-purpose programming language and toolchain for maintaining **robust**, **optimal** and **reusable** software. +Zig és un llenguatge de programació de propòsit general i una cadena d'eines per mantenir programari **robust**, **òptim** i **reutilitzable**. []($section.id("features")) -## ⚡ A Simple Language -Focus on debugging your application rather than debugging your programming language knowledge. +## ⚡ Un llenguatge senzill +Concentreu-vos a depurar la vostra aplicació en lloc de depurar el vostre coneixement del llenguatge de programació. -- No hidden control flow. -- No hidden memory allocations. -- No preprocessor, no macros. +- Sense flux de control ocult. +- Sense assignacions de memòria ocultes. +- Sense preprocessador, sense macros. ## ⚡ Comptime -A fresh approach to metaprogramming based on compile-time code execution and lazy evaluation. +Un enfocament nou a la metaprogramació basat en l'execució de codi en temps de compilació i avaluació tardana. -- Call any function at compile-time. -- Manipulate types as values without runtime overhead. -- Comptime emulates the target architecture. +- Crideu qualsevol funció en temps de compilació. +- Manipuleu tipus com a valors sense sobrecàrrega en temps d'execució. +- Comptime emula l'arquitectura objectiu. -## ⚡ Maintain it with Zig -Incrementally improve your C/C++/Zig codebase. +## ⚡ Manteniu-ho amb Zig +Milloreu incrementalment la vostra base de codi C/C++/Zig. -- Use Zig as a zero-dependency, drop-in C/C++ compiler that supports cross-compilation out-of-the-box. -- Leverage `zig build` to create a consistent development environment across all platforms. -- Add a Zig compilation unit to C/C++ projects, exposing the rich standard library to your C/C++ code. +- Feu servir Zig com un compilador C/C++ sense dependències i de substitució directa que admet la compilació creuada de manera nativa. +- Aprofiteu `zig build` per crear un entorn de desenvolupament consistent a totes les plataformes. +- Afegiu una unitat de compilació Zig als projectes C/C++, exposant l'extensa biblioteca estàndard al vostre codi C/C++. -# [Community]($section.id("community").attrs("section-title")) +# [Comunitat]($section.id("community").attrs("section-title")) -## [The Zig community is decentralized]($section.id("decentralized")) -Anyone is free to start and maintain their own space for the community to gather. -There is no concept of "official" or "unofficial", however, each gathering place has its own moderators and rules. +## [La comunitat Zig està descentralitzada]($section.id("decentralized")) +Tothom és lliure de començar i mantenir el seu propi espai per reunir la comunitat. +No hi ha concepte d'«oficial» o «no oficial»; tanmateix, cada lloc de reunió té els seus propis moderadors i normes. -## [Main development]($section.id("main-development")) -The Zig repository can be found at [https://github.com/ziglang/zig](https://github.com/ziglang/zig), where we also host the issue tracker and discuss proposals. -Contributors are expected to follow Zig's [Code of Conduct](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md). +## [Desenvolupament principal]($section.id("main-development")) +El repositori de Zig es pot trobar a [https://github.com/ziglang/zig](https://github.com/ziglang/zig), on també allotgem el seguiment d'incidències i discutim propostes. +S'espera que els col·laboradors segueixin el [Codi de conducta](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md) de Zig. # [Zig Software Foundation]($section.id("zsf").attrs("section-title")) -## The ZSF is a 501(c)(3) non-profit corporation. +## La ZSF és una corporació sense ànim de lucre 501(c)(3). -The Zig Software Foundation is a non-profit corporation founded in 2020 by Andrew Kelley, the creator of Zig, with the goal of supporting the development of the language. Currently, the ZSF is able to offer paid work at competitive rates to a small number of core contributors. We hope to be able to extend this offer to more core contributors in the future. +La Zig Software Foundation és una corporació sense ànim de lucre fundada el 2020 per Andrew Kelley, el creador de Zig, amb l'objectiu de donar suport al desenvolupament del llenguatge. Actualment, la ZSF pot oferir feina remunerada a tarifes competitives a un petit nombre de col·laboradors principals. Esperem poder estendre aquesta oferta a més col·laboradors principals en el futur. -The Zig Software Foundation is sustained by donations. +La Zig Software Foundation se sosté mitjançant donacions. -# [Sponsors]($section.id("sponsors").attrs("section-title")) +# [Patrocinadors]($section.id("sponsors").attrs("section-title")) -## [Corporate Sponsors]($section.id("corporate-sponsors")) -The following companies are providing direct financial support to the Zig Software foundation. - -## [GitHub Sponsors]($section.id("github-sponsors")) -Thanks to people who [sponsor Zig]($link.page('zsf')), the project is accountable to the open source community rather than corporate shareholders. In particular, these fine folks sponsor Zig for $200/month or more: +## [Patrocinadors corporatius]($section.id("corporate-sponsors")) +Les següents empreses proporcionen suport financer directe a la Zig Software Foundation. + +## [Patrocinadors de GitHub]($section.id("github-sponsors")) +Gràcies a les persones que [patrocinen Zig]($link.page('zsf')), el projecte és responsable davant la comunitat de codi obert en lloc dels accionistes corporatius. En particular, aquesta gent fantàstica patrocina Zig amb 200 $/mes o més: diff --git a/content/ca-ES/learn/build-system.smd b/content/ca-ES/learn/build-system.smd index 0b35b559f..2d6fd4cd3 100644 --- a/content/ca-ES/learn/build-system.smd +++ b/content/ca-ES/learn/build-system.smd @@ -1,54 +1,45 @@ --- -.title = "Zig Build System", +.title = "Sistema de Compilació de Zig", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "page.shtml", .custom = { - "mobile_menu_title": "Zig Build System", + "mobile_menu_title": "Sistema de Compilació", "toc": true, }, --- -# [When to bust out the Zig Build System?]($heading.id('build-system')) +# [Quan cal utilitzar el Sistema de Compilació de Zig?]($heading.id('build-system')) -The fundamental commands `zig build-exe`, `zig build-lib`, `zig build-obj`, and -`zig test` are often sufficient. However, sometimes a project needs another -layer of abstraction to manage the complexity of building from source. +Les ordres fonamentals `zig build-exe`, `zig build-lib`, `zig build-obj` i `zig test` sovint són suficients. No obstant això, de vegades un projecte necessita una altra capa d'abstracció per gestionar la complexitat de la compilació des del codi font. -For example, perhaps one of these situations applies: +Per exemple, potser alguna d'aquestes situacions s'aplica: -- The command line becomes too long and unwieldy, and you want some place to - write it down. -- You want to build many things, or the build process contains many steps. -- You want to take advantage of concurrency and caching to reduce build time. -- You want to expose configuration options for the project. -- The build process is different depending on the target system and other options. -- You have dependencies on other projects. -- You want to avoid an unnecessary dependency on cmake, make, shell, msvc, - python, etc., making the project accessible to more contributors. -- You want to provide a package to be consumed by third parties. -- You want to provide a standardized way for tools such as IDEs to semantically understand - how to build the project. +- La línia d'ordres esdevé massa llarga i difícil de gestionar, i voleu un lloc on anotar-la. +- Voleu compilar moltes coses, o el procés de compilació conté molts passos. +- Voleu aprofitar la concurrència i la memòria cau per reduir el temps de compilació. +- Voleu exposar opcions de configuració per al projecte. +- El procés de compilació és diferent segons el sistema objectiu i altres opcions. +- Teniu dependències d'altres projectes. +- Voleu evitar una dependència innecessària de cmake, make, shell, msvc, python, etc., fent el projecte accessible a més col·laboradors. +- Voleu proporcionar un paquet per ser consumit per tercers. +- Voleu proporcionar una manera estandarditzada perquè eines com els IDEs entenguin semànticament com compilar el projecte. -If any of these apply, the project will benefit from using the Zig Build System. +Si alguna d'aquestes s'aplica, el projecte es beneficiarà d'utilitzar el Sistema de Compilació de Zig. -# [Getting Started]($heading.id('getting-started')) -## [Simple Executable]($heading.id('simple')) -This build script creates an executable from a Zig file that contains a public `main` function definition. +# [Primers Passos]($heading.id('getting-started')) +## [Executable Senzill]($heading.id('simple')) +Aquest script de compilació crea un executable a partir d'un fitxer Zig que conté una definició de funció `main` pública. []($code.language('=html').buildAsset("build-system/1-simple-executable/hello.zig")) []($code.language('=html').buildAsset("build-system/1-simple-executable/build.zig")) -## [Installing Build Artifacts]($heading.id('installing-artifacts')) +## [Instal·lant Artefactes de Compilació]($heading.id('installing-artifacts')) -The Zig build system, like most build systems, is based on modeling the project as a directed acyclic graph (DAG) of steps, which are independently and concurrently run. +El sistema de compilació de Zig, com la majoria de sistemes de compilació, es basa en modelar el projecte com un graf dirigit acíclic (DAG) de passos, que s'executen de manera independent i concurrent. -By default, the main step in the graph is the **Install** step, whose purpose -is to copy build artifacts into their final resting place. The Install step -starts with no dependencies, and therefore nothing will happen when `zig build` -is run. A project's build script must add to the set of things to install, which -is what the `installArtifact` function call does above. +Per defecte, el pas principal al graf és el pas d'**Instal·lació**, la finalitat del qual és copiar els artefactes de compilació al seu lloc final. El pas d'instal·lació comença sense dependències i, per tant, no passarà res quan s'executi `zig build`. El script de compilació d'un projecte ha d'afegir al conjunt de coses a instal·lar, que és el que fa la crida a la funció `installArtifact` anterior. -**Output** +**Sortida** ``` ├── build.zig ├── hello.zig @@ -58,81 +49,114 @@ is what the `installArtifact` function call does above. └── hello ``` -There are two generated directories in this output: `.zig-cache` and `zig-out`. The first one contains files that will make subsequent builds faster, but these files are not intended to be checked into source-control and this directory can be completely deleted at any time with no consequences. +Hi ha dos directoris generats en aquesta sortida: `.zig-cache` i `zig-out`. El primer conté fitxers que faran que les compilacions posteriors siguin més ràpides, però aquests fitxers no estan destinats a ser inclosos al control de codi font i aquest directori es pot suprimir completament en qualsevol moment sense conseqüències. -The second one, `zig-out`, is an "installation prefix". This maps to the standard file system hierarchy concept. This directory is not chosen by the project, but by the user of `zig build` with the `--prefix` flag (`-p` for short). +El segon, `zig-out`, és un "prefix d'instal·lació". Això es correspon amb el concepte de jerarquia de sistema de fitxers estàndard. Aquest directori no és escollit pel projecte, sinó per l'usuari de `zig build` amb la bandera `--prefix` (`-p` per abreujar). -You, as the project maintainer, pick what gets put in this directory, but the user chooses where to install it in their system. The build script cannot hardcode output paths because this would break caching, concurrency, and composability, as well as annoy the final user. +Com a mantenidor del projecte, trieu què es posa en aquest directori, però l'usuari tria on instal·lar-lo al seu sistema. El script de compilació no pot fixar rutes de sortida perquè això trencaria la memòria cau, la concurrència i la composabilitat, a més de molestar l'usuari final. -## [Adding a Convenience Step for Running the Application]($heading.id('run-step')) +## [Afegint un Pas de Conveniència per Executar l'Aplicació]($heading.id('run-step')) -It is common to add a **Run** step to provide a way to run one's main application directly -from the build command. +És comú afegir un pas d'**Execució** per proporcionar una manera d'executar l'aplicació principal directament des de l'ordre de compilació. []($code.language('=html').buildAsset("build-system/convenience-run-step/hello.zig")) []($code.language('=html').buildAsset("build-system/convenience-run-step/build.zig")) -# [The Basics]($heading.id('basics')) +# [Conceptes Bàsics]($heading.id('basics')) + + + +## [Opcions Proporcionades per l'Usuari]($heading.id('user-options')) + + + +Utilitzeu `b.option` per fer que l'script de compilació sigui configurable per als usuaris finals, així com per a altres projectes que depenen del projecte com a paquet. -## [User-Provided Options]($heading.id('user-options')) -Use `b.option` to make the build script configurable to end users as well as -other projects that depend on the project as a package. []($code.language('=html').buildAsset("build-system/2-user-provided-options/build.zig")) + []($code.language('=html').buildAsset("build-system/2-user-provided-options/example.zig")) -Please direct your attention to these lines: + + +Dirigiu la vostra atenció a aquestes línies: + + ``` + Project-Specific Options: + -Dwindows=[bool] Target Microsoft Windows + ``` -This part of the help menu is auto-generated based on running the `build.zig` logic. Users -can discover configuration options of the build script this way. -## [Standard Configuration Options]($heading.id('standard-options')) -Previously, we used a boolean flag to indicate building for Windows. However, we can do -better. +Aquesta part del menú d'ajuda s'autogenera basant-se en l'execució de la lògica de `build.zig`. Els usuaris poden descobrir les opcions de configuració de l'script de compilació d'aquesta manera. + + + +## [Opcions de Configuració Estàndard]($heading.id('standard-options')) + + + +Anteriorment, utilitzàvem una bandera booleana per indicar la compilació per a Windows. No obstant això, podem fer-ho millor. + + + +La majoria de projectes volen proporcionar la capacitat de canviar les configuracions d'objectiu i optimització. Per fomentar les convencions de noms estàndard per a aquestes opcions, Zig proporciona les funcions d'ajuda, `standardTargetOptions` i `standardOptimizeOption`. + -Most projects want to provide the ability to change the target and optimization settings. -In order to encourage standard naming conventions for these options, Zig provides the -helper functions, `standardTargetOptions` and `standardOptimizeOption`. -Standard target options allows the person running `zig build` to choose what -target to build for. By default, any target is allowed, and no choice means to -target the host system. Other options for restricting supported target set are -available. +Les opcions d'objectiu estàndard permeten a la persona que executa `zig build` triar per a quin objectiu compilar. Per defecte, es permet qualsevol objectiu, i no triar cap significa apuntar al sistema amfitrió. Hi ha altres opcions disponibles per restringir el conjunt d'objectius compatibles. + + + +Les opcions d'optimització estàndard permeten a la persona que executa `zig build` seleccionar entre `Debug`, `ReleaseSafe`, `ReleaseFast` i `ReleaseSmall`. Per defecte, cap de les opcions de llançament es considera l'elecció preferible per l'script de compilació, i l'usuari ha de prendre una decisió per crear una compilació de llançament. + -Standard optimization options allow the person running `zig build` to select -between `Debug`, `ReleaseSafe`, `ReleaseFast`, and `ReleaseSmall`. By default -none of the release options are considered the preferable choice by the build -script, and the user must make a decision in order to create a release build. []($code.language('=html').buildAsset("build-system/3-standard-config-options/hello.zig")) + []($code.language('=html').buildAsset("build-system/3-standard-config-options/build.zig")) -Now, our `--help` menu contains more items: + + +Ara, el nostre `--help` menu conté més ítems: + + ``` + Project-Specific Options: + -Dtarget=[string] The CPU architecture, OS, and ABI to build for + -Dcpu=[string] Target CPU features to add or subtract + -Doptimize=[enum] Prioritize performance, safety, or binary size (-O flag) + Supported Values: + Debug + ReleaseSafe + ReleaseFast + ReleaseSmall + ``` -It is entirely possible to create these options via `b.option` directly, but this -API provides a commonly used naming convention for these frequently used settings. -In our terminal output, observe that we passed `-Dtarget=x86_64-windows -Doptimize=ReleaseSmall`. -Compared to the first example, now we see different files in the installation prefix: + +És totalment possible crear aquestes opcions directament mitjançant `b.option`, però aquesta API proporciona una convenció de noms d'ús comú per a aquestes configuracions d'ús freqüent. + + + +A la nostra sortida del terminal, observeu que vam passar `-Dtarget=x86_64-windows -Doptimize=ReleaseSmall`. En comparació amb el primer exemple, ara veiem fitxers diferents al prefix d'instal·lació: ``` zig-out/ @@ -140,29 +164,24 @@ zig-out/ └── hello.exe ``` -## [Options for Conditional Compilation]($heading.id('conditional-compilation')) +## [Opcions per a la Compilació Condicional]($heading.id('conditional-compilation')) -To pass options from the build script and into the project's Zig code, use -the `Options` step. +Per passar opcions de l'script de compilació al codi Zig del projecte, utilitzeu el pas `Options`. []($code.language('=html').buildAsset("build-system/conditional-compilation/app.zig")) []($code.language('=html').buildAsset("build-system/conditional-compilation/build.zig")) -In this example, the data provided by `@import("config")` is comptime-known, -preventing the `@compileError` from triggering. If we had passed `-Dversion=0.2.3` -or omitted the option, then we would have seen the compilation of `app.zig` fail with -the "too old" error. +En aquest exemple, les dades proporcionades per `@import("config")` són conegudes en temps de compilació, evitant que s'activi `@compileError`. Si haguéssim passat `-Dversion=0.2.3` o ometut l'opció, hauríem vist fallar la compilació de `app.zig` amb l'error "massa antic". -## [Static Library]($heading.id('static-library')) +## [Biblioteca Estàtica]($heading.id('static-library')) -This build script creates a static library from Zig code, and then also an -executable from other Zig code that consumes it. +Aquest script de compilació crea una biblioteca estàtica a partir de codi Zig, i després també un executable a partir d'altre codi Zig que la consumeix. []($code.language('=html').buildAsset("build-system/simple-static-library/fizzbuzz.zig")) []($code.language('=html').buildAsset("build-system/simple-static-library/demo.zig")) []($code.language('=html').buildAsset("build-system/simple-static-library/build.zig")) -In this case, only the static library ends up being installed: +En aquest cas, només la biblioteca estàtica acaba sent instal·lada: ``` zig-out/ @@ -170,8 +189,7 @@ zig-out/ └── libfizzbuzz.a ``` -However, if you look closely, the build script contains an option to also install the demo. -If we additionally pass `-Denable-demo`, then we see this in the installation prefix: +No obstant això, si observeu amb atenció, el script de compilació conté una opció per instal·lar també la demostració. Si a més passem `-Denable-demo`, veiem això al prefix d'instal·lació: ``` zig-out/ @@ -181,19 +199,15 @@ zig-out/ └── libfizzbuzz.a ``` -Note that despite the unconditional call to `addExecutable`, the build system in fact -does not waste any time building the `demo` executable unless it is requested -with `-Denable-demo`, because the build system is based on a Directed Acyclic -Graph with dependency edges. +Tingueu en compte que, malgrat la crida incondicional a `addExecutable`, el sistema de compilació de fet no perd temps compilant l'executable `demo` tret que se sol·liciti amb `-Denable-demo`, perquè el sistema de compilació es basa en un Graf Dirigit Acíclic amb arestes de dependència. -## [Dynamic Library]($heading.id('dynamic-library')) +## [Biblioteca Dinàmica]($heading.id('dynamic-library')) -Here we keep all the files the same from the [Static Library](#static-library) example, except -the `build.zig` file is changed. +Aquí mantenim tots els fitxers igual que en l'exemple de la [Biblioteca Estàtica](#static-library), excepte que es canvia el fitxer `build.zig`. []($code.language('=html').buildAsset("build-system/dynamic-library/build.zig")) -**Output** +**Sortida** ``` zig-out └── lib @@ -202,43 +216,28 @@ zig-out └── libfizzbuzz.so.1.2.3 ``` -As in the static library example, to make an executable link against it, use code like this: +Com en l'exemple de la biblioteca estàtica, per fer que un executable s'enllaci amb ella, utilitzeu codi com aquest: ```zig exe.linkLibrary(libfizzbuzz); ``` -## [Testing]($heading.id('testing')) +## [Proves]($heading.id('testing')) -Individual files can be tested directly with `zig test foo.zig`, however, more -complex use cases can be solved by orchestrating testing via the build script. +Els fitxers individuals es poden provar directament amb `zig test foo.zig`, però els casos d'ús més complexos es poden resoldre orquestrant les proves mitjançant l'script de compilació. -When using the build script, unit tests are broken into two different steps in -the build graph, the **Compile** step and the **Run** step. Without a call to -`addRunArtifact`, which establishes a dependency edge between these two steps, -the unit tests will not be executed. +Quan s'utilitza l'script de compilació, les proves unitàries es divideixen en dos passos diferents al graf de compilació: el pas de **Compilació** i el pas d'**Execució**. Sense una crida a `addRunArtifact`, que estableix una aresta de dependència entre aquests dos passos, les proves unitàries no s'executaran. -The *Compile* step can be configured the same as any executable, library, or -object file, for example by [linking against system libraries](#linking-to-system-libraries), -setting target options, or adding additional compilation units. +El pas de *Compilació* es pot configurar de la mateixa manera que qualsevol executable, biblioteca o fitxer objecte; per exemple, [enllaçant amb biblioteques del sistema](#linking-to-system-libraries), configurant opcions d'objectiu o afegint unitats de compilació addicionals. -The *Run* step can be configured the same as any Run step, for example by -skipping execution when the host is not capable of executing the binary. +El pas d'*Execució* es pot configurar de la mateixa manera que qualsevol pas d'Execució; per exemple, ometent l'execució quan l'amfitrió no és capaç d'executar el binari. -When using the build system to run unit tests, the build runner and the test -runner communicate via *stdin* and *stdout* in order to run multiple unit test -suites concurrently, and report test failures in a meaningful way without -having their output jumbled together. This is one reason why -[writing to *standard out* in unit tests is problematic](https://github.com/ziglang/zig/issues/15091) - -it will interfere with this communication channel. On the flip side, this -mechanism will enable an upcoming feature, which is is the -[ability for a unit test to expect a *panic*](https://github.com/ziglang/zig/issues/1356). +Quan s'utilitza el sistema de compilació per executar proves unitàries, l'executor de compilació i l'executor de proves es comuniquen mitjançant *stdin* i *stdout* per tal d'executar diverses suites de proves unitàries de manera concurrent, i informar de les fallades de les proves d'una manera significativa sense que la seva sortida es barregi. Aquesta és una de les raons per les quals [escriure a *standard out* en proves unitàries és problemàtic](https://github.com/ziglang/zig/issues/15091) - interferirà amb aquest canal de comunicació. D'altra banda, aquest mecanisme habilitarà una característica propera, que és la [capacitat d'una prova unitària d'esperar un *panic*](https://github.com/ziglang/zig/issues/1356). []($code.language('=html').buildAsset("build-system/unit-testing/main.zig")) []($code.language('=html').buildAsset("build-system/unit-testing/build.zig")) -In this case it might be a nice adjustment to enable `skip_foreign_checks` for -the unit tests: +En aquest cas, podria ser un bon ajust habilitar `skip_foreign_checks` per a les proves unitàries: ```diff @@ -23,6 +23,7 @@ @@ -253,47 +252,35 @@ the unit tests: []($code.language('=html').buildAsset("build-system/unit-testing-skip-foreign/build.zig")) -## [Linking to System Libraries]($heading.id('linking-to-system-libraries')) +## [Enllaçament a Biblioteques del Sistema]($heading.id('linking-to-system-libraries')) -For satisfying library dependencies, there are two choices: +Per satisfer les dependències de la biblioteca, hi ha dues opcions: -1. Provide these libraries via the Zig Build System - (see [Package Management](#) and [Static Library](#static-library)). -2. Use the files provided by the host system. +1. Proporcionar aquestes biblioteques mitjançant el Sistema de Compilació de Zig + (vegeu [Gestió de Paquets](#) i [Biblioteca Estàtica](#static-library)). +2. Utilitzar els fitxers proporcionats pel sistema amfitrió. -For the use case of upstream project maintainers, obtaining these libraries via -the Zig Build System provides the least friction and puts the configuration -power in the hands of those maintainers. Everyone who builds this way will have -reproducible, consistent results as each other, and it will work on every -operating system and even support cross-compilation. Furthermore, it allows the -project to decide with perfect precision the exact versions of its entire -dependency tree it wishes to build against. This is expected to be the -generally preferred way to depend on external libraries. +Per al cas d'ús dels mantenidors de projectes *upstream*, obtenir aquestes biblioteques mitjançant el Sistema de Compilació de Zig proporciona la menor fricció i posa el poder de configuració en mans d'aquests mantenidors. Tothom que compili d'aquesta manera tindrà resultats reproduïbles i consistents entre si, i funcionarà en tots els sistemes operatius i fins i tot admetrà la compilació creuada. A més, permet al projecte decidir amb perfecta precisió les versions exactes de tot el seu arbre de dependències amb les quals desitja compilar. S'espera que aquesta sigui la manera generalment preferida de dependre de biblioteques externes. -However, for the use case of packaging software into repositories such as -Debian, Homebrew, or Nix, it is mandatory to link against system libraries. So, -build scripts must -[detect the build mode](https://github.com/ziglang/zig/issues/14281) and configure accordingly. +No obstant això, per al cas d'ús d'empaquetar programari en repositoris com Debian, Homebrew o Nix, és obligatori enllaçar amb biblioteques del sistema. Per tant, els scripts de compilació han de [detectar el mode de compilació](https://github.com/ziglang/zig/issues/14281) i configurar-se en conseqüència. []($code.language('=html').buildAsset("build-system/system-libraries/build.zig")) -Users of `zig build` may use `--search-prefix` to provide additional -directories that are considered "system directories" for the purposes of finding -static and dynamic libraries. +Els usuaris de `zig build` poden utilitzar `--search-prefix` per proporcionar directoris addicionals que es consideren "directoris del sistema" per a la cerca de biblioteques estàtiques i dinàmiques. -# [Generating Files]($heading.id('generating-files')) +# [Generant Fitxers]($heading.id('generating-files')) -## [Running System Tools]($heading.id('system-tools')) -This version of hello world expects to find a `word.txt` file in the same path, -and we want to use a system tool to generate it starting from a JSON file. +## [Executant Eines del Sistema]($heading.id('system-tools')) +Aquesta versió de *hello world* espera trobar un fitxer `word.txt` al mateix camí, +i volem utilitzar una eina del sistema per generar-lo a partir d'un fitxer JSON. -Be aware that system dependencies will make your project harder to build for your -users. This build script depends on `jq`, for example, which is not present by -default in most Linux distributions and which might be an unfamiliar tool for -Windows users. +Cal tenir en compte que les dependències del sistema faran que el vostre projecte +sigui més difícil de compilar per als usuaris. Aquest script de compilació depèn +de `jq`, per exemple, que no està present per defecte a la majoria de distribucions +Linux i que pot ser una eina desconeguda per als usuaris de Windows. -The next section will replace `jq` with a Zig tool included in the source tree, -which is the preferred approach. +La secció següent substituirà `jq` per una eina Zig inclosa a l'arbre de codi font, +que és l'enfocament preferible. **`words.json`** ```json @@ -307,7 +294,7 @@ which is the preferred approach. []($code.language('=html').buildAsset("build-system/10.5-system-tool/src/main.zig")) []($code.language('=html').buildAsset("build-system/10.5-system-tool/build.zig")) -**Output** +**Sortida** ``` zig-out @@ -315,12 +302,11 @@ zig-out └── word.txt ``` -Note how `captureStdOut` creates a temporary file with the output of the `jq` invocation. +Fixeu-vos que `captureStdOut` crea un fitxer temporal amb la sortida de la invocació de `jq`. -## [Running the Project's Tools]($heading.id('project-tools')) +## [Executant les Eines del Projecte]($heading.id('project-tools')) -This version of hello world expects to find a `word.txt` file in the same path, -and we want to produce it at build-time by invoking a Zig program on a JSON file. +Aquesta versió de *hello world* espera trobar un fitxer `word.txt` al mateix camí, i volem produir-lo en temps de compilació invocant un programa Zig sobre un fitxer JSON. **`tools/words.json`** ```json @@ -337,7 +323,7 @@ and we want to produce it at build-time by invoking a Zig program on a JSON file []($code.language('=html').buildAsset("build-system/11-zig-tool/build.zig")) -**Output** +**Sortida** ``` zig-out @@ -346,10 +332,9 @@ zig-out ``` -## [Producing Assets for `@embedFile`]($heading.id('embed-file')) +## [Produint Recursos per a `@embedFile`]($heading.id('embed-file')) -This version of hello world wants to `@embedFile` an asset generated at build time, -which we're going to produce using a tool written in Zig. +Aquesta versió de *hello world* vol fer servir `@embedFile` amb un recurs generat en temps de compilació, que produirem utilitzant una eina escrita en Zig. **`tools/words.json`** ```json @@ -366,7 +351,7 @@ which we're going to produce using a tool written in Zig. []($code.language('=html').buildAsset("build-system/12-embedfile/build.zig")) -**Output** +**Sortida** ``` zig-out/ @@ -374,15 +359,14 @@ zig-out/    └── hello ``` -## [Generating Zig Source Code]($heading.id('generating-zig')) -This build file uses a Zig program to generate a Zig file and then exposes it -to the main program as a module dependency. +## [Generant Codi Font Zig]($heading.id('generating-zig')) +Aquest fitxer de compilació utilitza un programa Zig per generar un fitxer Zig i després l'exposa al programa principal com a dependència de mòdul. []($code.language('=html').buildAsset("build-system/13-import/src/main.zig")) []($code.language('=html').buildAsset("build-system/13-import/tools/generate_struct.zig")) []($code.language('=html').buildAsset("build-system/13-import/build.zig")) -**Output** +**Sortida** ``` zig-out/ @@ -390,41 +374,29 @@ zig-out/    └── hello ``` -## [Dealing With One or More Generated Files]($heading.id('write-files')) +## [Gestionant un o més Fitxers Generats]($heading.id('write-files')) -The **WriteFiles** step provides a way to generate one or more files which -share a parent directory. The generated directory lives inside the local `.zig-cache`, -and each generated file is independently available as a `std.Build.LazyPath`. -The parent directory itself is also available as a `LazyPath`. +El pas **WriteFiles** proporciona una manera de generar un o més fitxers que comparteixen un mateix directori pare. El directori generat viu dins de la `.zig-cache` local, i cada fitxer generat està disponible de manera independent com a `std.Build.LazyPath`. El directori pare també està disponible com a `LazyPath`. -This API supports writing arbitrary strings to the generated directory as well -as copying files into it. +Aquesta API permet escriure cadenes arbitràries al directori generat així com copiar-hi fitxers. []($code.language('=html').buildAsset("build-system/write-files/src/main.zig")) []($code.language('=html').buildAsset("build-system/write-files/build.zig")) -**Output** +**Sortida** ``` zig-out/ └── project.tar.gz ``` -## [Mutating Source Files in Place]($heading.id('mutating-source')) +## [Mutant Fitxers Font in Situ]($heading.id('mutating-source')) -It is uncommon, but sometimes the case that a project commits generated files -into version control. This can be useful when the generated files are seldomly updated -and have burdensome system dependencies for the update process, but *only* during the -update process. +No és habitual, però de vegades passa que un projecte fa *commit* de fitxers generats al control de versions. Això pot ser útil quan els fitxers generats s'actualitzen poques vegades i tenen dependències de sistema feixugues per al procés d'actualització, però *només* durant aquest procés. -For this, **WriteFiles** provides a way to accomplish this task. This is a feature that -[will be extracted from WriteFiles into its own Build Step](https://github.com/ziglang/zig/issues/14944) -in a future Zig version. +Per a tal efecte, **WriteFiles** proporciona una manera d'aconseguir-ho. És una funcionalitat que [s'extraurà de WriteFiles en un Pas de Compilació propi](https://github.com/ziglang/zig/issues/14944) en una versió futura de Zig. -Be careful with this functionality; it should not be used during the normal -build process, but as a utility run by a developer with intention to update -source files, which will then be committed to version control. If it is done -during the normal build process, it will cause caching and concurrency bugs. +Aneu amb compte amb aquesta funcionalitat; no s'ha d'utilitzar durant el procés de compilació normal, sinó com una utilitat que executa un desenvolupador amb la intenció d'actualitzar fitxers font, els quals després s'afegiran al control de versions. Si s'utilitza durant el procés de compilació normal, provocarà errors de memòria cau i de concurrència. []($code.language('=html').buildAsset("build-system/mutate-source-files/tools/proto_gen.zig")) []($code.language('=html').buildAsset("build-system/mutate-source-files/src/main.zig")) @@ -441,18 +413,18 @@ update-protocol success ``` -After running this command, `src/protocol.zig` is updated in place. +Després d'executar aquesta ordre, `src/protocol.zig` s'actualitza in situ. -# [Handy Examples]($heading.id('examples')) +# [Exemples Útils]($heading.id('examples')) -## [Build for multiple targets to make a release]($heading.id('release')) +## [Compilar per a múltiples objectius per fer un llançament]($heading.id('release')) -In this example we're going to change some defaults when creating an `InstallArtifact` step in order to put the build for each target into a separate subdirectory inside the install path. +En aquest exemple canviarem algunes opcions per defecte en crear un pas `InstallArtifact` per tal de posar la compilació de cada objectiu en un subdirectori separat dins del camí d'instal·lació. []($code.language('=html').buildAsset("build-system/10-release/build.zig")) []($code.language('=html').buildAsset("build-system/10-release/hello.zig")) -**Output** +**Sortida** ``` zig-out diff --git a/content/ca-ES/learn/getting-started.smd b/content/ca-ES/learn/getting-started.smd index c323fa0f2..927194370 100644 --- a/content/ca-ES/learn/getting-started.smd +++ b/content/ca-ES/learn/getting-started.smd @@ -1,38 +1,35 @@ --- -.title = "Getting Started", +.title = "Primers passos", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "page.shtml", .custom = { - "mobile_menu_title": "Getting Started", + "mobile_menu_title": "Primers passos", "toc": true, }, --- -# Tagged release or nightly build? -Zig has not yet reached v1.0 and the current release cycle is tied to new releases of LLVM, which have a ~6 months cadence. -In practical terms, **Zig releases tend to be far apart and eventually become stale given the current speed of development**. +# Versió etiquetada o compilació *nightly*? +Zig encara no ha arribat a la v1.0 i el cicle de llançaments actual està lligat a noves versions de LLVM, que tenen una cadència d'uns 6 mesos. +En termes pràctics, **els llançaments de Zig acostumen a estar força espaiats i, amb l'actual velocitat de desenvolupament, acaben quedant desfasats**. -It's fine to evaluate Zig using a tagged version, but if you decide that you like Zig and -want to dive deeper, **we encourage you to upgrade to a nightly build**, mainly because -that way it will be easier for you to get help: most of the community and sites like -[zig.guide](https://zig.guide) track the master branch for the reasons stated above. +És perfecte avaluar Zig amb una versió etiquetada, però si decidiu que us agrada i voleu aprofundir-hi, **us recomanem que passeu a una compilació *nightly***, sobretot perquè així us serà més fàcil obtenir ajuda: la major part de la comunitat i llocs com [zig.guide](https://zig.guide) segueixen la branca *master* pels motius esmentats. -The good news is that it's very easy to switch from one Zig version to another, or even have multiple versions present on the system at the same time: Zig releases are self-contained archives that can be placed anywhere in your system. +La bona notícia és que és molt fàcil canviar d'una versió de Zig a una altra, o fins i tot tenir-ne diverses al sistema alhora: els llançaments de Zig són arxius auto-contenits que es poden col·locar a qualsevol lloc del sistema. -# Installing Zig -## [Direct download]($heading.id('direct')) -This is the most straight-forward way of obtaining Zig: grab a Zig bundle for your platform from the [Downloads](/download) page, -extract it in a directory and add it to your `PATH` to be able to call `zig` from any location. +# Instal·lar Zig +## [Descàrrega directa]($heading.id('direct')) +Aquesta és la manera més senzilla d'obtenir Zig: descarregueu un paquet per a la vostra plataforma des de la pàgina de [Descàrregues](/download), +extraieu-lo en un directori i afegiu-lo al vostre `PATH` per poder cridar `zig` des de qualsevol ubicació. -### Setting up PATH on Windows -To setup your path on Windows run **one** of the following snippets of code in a Powershell instance. -Choose if you want to apply this change on a system-wide level (requires running Powershell with admin privileges) -or just for your user, and **make sure to change the snippet to point at the location where your copy of Zig lies**. -The `;` before `C:` is not a typo. +### Configurar el PATH a Windows +Per configurar el PATH a Windows, executeu **un** dels fragments de codi següents en una sessió de Powershell. +Trieu si voleu aplicar el canvi a nivell de sistema (cal executar Powershell amb privilegis d'administrador) +o només per al vostre usuari, i **assegureu-vos d'ajustar el fragment perquè apunti on tingueu Zig**. +El `;` abans de `C:` no és un error tipogràfic. -System wide (**admin** Powershell): +Nivell de sistema (Powershell **admin**): ``` [Environment]::SetEnvironmentVariable( "Path", @@ -41,7 +38,7 @@ System wide (**admin** Powershell): ) ``` -User level (Powershell): +Nivell d'usuari (Powershell): ``` [Environment]::SetEnvironmentVariable( "Path", @@ -49,40 +46,40 @@ User level (Powershell): "User" ) ``` -After you're done, restart your Powershell instance. +Quan acabeu, reinicieu la sessió de Powershell. -### Setting up PATH on Linux, macOS, BSD -Add the location of your zig binary to your PATH environment variable. +### Configurar el PATH a Linux, macOS, BSD +Afegiu la ubicació del binari de Zig a la variable d'entorn PATH. -This is generally done by adding an export line to your shell startup script (`.profile`, `.zshrc`, ...) +Això normalment es fa afegint una línia `export` a l'script d'inici del vostre *shell* (`.profile`, `.zshrc`, ...) ```bash export PATH=$PATH:~/path/to/zig ``` -After you're done, either `source` your startup file or restart your shell. +Quan acabeu, feu `source` del fitxer d'inici o reinicieu el *shell*. -## [Package managers]($heading.id('managers')) +## [Gestors de paquets]($heading.id('managers')) ### Windows **WinGet** -Zig is available on [WinGet](https://github.com/microsoft/winget-pkgs/tree/master/manifests/z/zig/zig). +Zig està disponible a [WinGet](https://github.com/microsoft/winget-pkgs/tree/master/manifests/z/zig/zig). ``` winget install -e --id zig.zig ``` **Chocolatey** -Zig is available on [Chocolatey](https://chocolatey.org/packages/zig). +Zig està disponible a [Chocolatey](https://chocolatey.org/packages/zig). ``` choco install zig ``` **Scoop** -Zig is available on [Scoop](https://scoop.sh/#/apps?q=zig&id=7e124d6047c32d426e4143ab395d863fc9d6d491). +Zig està disponible a [Scoop](https://scoop.sh/#/apps?q=zig&id=7e124d6047c32d426e4143ab395d863fc9d6d491). ``` scoop install zig ``` -Latest [dev build](https://scoop.sh/#/apps?q=zig&id=921df07e75042de645204262e784a17c2421944c): +Darrera [build de desenvolupament](https://scoop.sh/#/apps?q=zig&id=921df07e75042de645204262e784a17c2421944c): ``` scoop bucket add versions scoop install versions/zig-dev @@ -91,7 +88,7 @@ scoop install versions/zig-dev ### macOS **Homebrew** -Latest tagged release: +Darrera versió etiquetada: ``` brew install zig ``` @@ -101,36 +98,36 @@ brew install zig sudo port install zig ``` ### Linux -Zig is also present in many package managers for Linux. [Here](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager) -you can find an updated list but keep in mind that some packages might bundle outdated versions of Zig. +Zig també és present a molts gestors de paquets per a Linux. [Aquí](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager) +hi trobareu una llista actualitzada, però tingueu en compte que alguns paquets poden incloure versions antigues de Zig. -## [Building from source]($heading.id('source')) -[Here](https://github.com/ziglang/zig/wiki/Building-Zig-From-Source) -you can find more information on how to build Zig from source for Linux, macOS and Windows. +## [Compilant des del codi font]($heading.id('source')) +[Aquí](https://github.com/ziglang/zig/wiki/Building-Zig-From-Source) +podeu trobar més informació sobre com compilar Zig des del codi font per a Linux, macOS i Windows. -# Recommended tools -## Syntax Highlighters and LSP -All major text editors have syntax highlight support for Zig. -Some bundle it, some others require installing a plugin. +# Eines recomanades +## Ressaltat de sintaxi i LSP +Tots els editors de text principals tenen suport de ressaltat de sintaxi per a Zig. +Alguns ja el porten inclòs; d'altres requereixen instal·lar un connector. -If you're interested in a deeper integration between Zig and your editor, -checkout [zigtools/zls](https://github.com/zigtools/zls). +Si us interessa una integració més profunda entre Zig i l'editor, +consulteu [zigtools/zls](https://github.com/zigtools/zls). -If you're interested in what else is available, checkout the [Tools](tools) section. +Si voleu saber què més hi ha disponible, doneu un cop d'ull a la secció [Eines](tools). -# Run Hello World -If you completed the installation process correctly, you should now be able to invoke the Zig compiler from your shell. -Let's test this by creating your first Zig program! +# Executar Hello World +Si heu completat correctament el procés d'instal·lació, ara hauríeu de poder invocar el compilador de Zig des del vostre *shell*. +Posem-ho a prova creant el vostre primer programa Zig! -Navigate to your projects directory and run: +Aneu al directori dels vostres projectes i executeu: ```bash mkdir hello-world cd hello-world zig init ``` -This should output: +Això hauria de mostrar: ``` info: created build.zig info: created build.zig.zon @@ -139,21 +136,20 @@ info: created src/root.zig info: see `zig build --help` for a menu of options ``` -Running `zig build run` should then compile the executable and run it, ultimately resulting in: +Executar `zig build run` hauria de compilar l'executable i executar-lo, resultant en: ``` All your codebase are belong to us. Run `zig build test` to run the tests. ``` -Congratulations, you have a working Zig installation! +Enhorabona, teniu una instal·lació de Zig funcional! -# Next steps -**Check out other resources present in the [Learn](/learn) section**, make sure to find the Documentation for your version -of Zig (note: nightly builds should use `master` docs) and consider giving [zig.guide](https://zig.guide) a read. +# Següents passos +**Doneu un cop d'ull als altres recursos de la secció [Aprendre](/learn)**, assegureu-vos de trobar la documentació de la vostra versió +de Zig (nota: les compilacions *nightly* han d'usar la documentació de `master`) i considereu llegir [zig.guide](https://zig.guide). -Zig is a young project and unfortunately we don't have yet the capacity to produce extensive documentation and learning -materials for everything, so you should consider [joining one of the existing Zig communities](https://github.com/ziglang/zig/wiki/Community) -to get help when you get stuck, as well as checking out initiatives like [Zig SHOWTIME](https://zig.show). +Zig és un projecte jove i, malauradament, encara no tenim la capacitat de produir documentació i material didàctic extens per a tot. Per això, val la pena [unir-vos a alguna de les comunitats de Zig](https://github.com/ziglang/zig/wiki/Community) +per rebre ajuda quan us quedeu encallats, així com seguir iniciatives com [Zig SHOWTIME](https://zig.show). -Finally, if you enjoy Zig and want to help speed up the development, [consider donating to the Zig Software Foundation](/zsf) +Finalment, si us agrada Zig i voleu ajudar a accelerar-ne el desenvolupament, [considereu fer una donació a la Zig Software Foundation](/zsf) . diff --git a/content/ca-ES/learn/index.smd b/content/ca-ES/learn/index.smd index fd607b257..519f63b59 100644 --- a/content/ca-ES/learn/index.smd +++ b/content/ca-ES/learn/index.smd @@ -1,59 +1,59 @@ --- -.title = "Learn", +.title = "Aprèn", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "learn.shtml", .custom = { - "mobile_menu_title": "Learn", + "mobile_menu_title": "Aprèn", }, --- -# [Learn]($section.id('learn')) -This section lists resources useful to go from knowing nothing about Zig up -to understanding its philosophy. +# [Aprèn]($section.id('learn')) +Aquesta secció enumera recursos útils per passar de no saber res de Zig a +entendre la seva filosofia. -## [Guides]($section.id('guides')) -This section is eventually going to be bundled with Zig's standard library documentation, but -in the meantime you can browse it from here. +## [Guies]($section.id('guides')) +Aquesta secció s'inclourà finalment amb la documentació de la biblioteca estàndard de Zig, però +mentrestant la podeu consultar des d'aquí. -- [Zig Build System](./build-system/) -Introduction to the Zig build system. +- [Sistema de compilació de Zig](./build-system/) +Introducció al sistema de compilació de Zig. -## Introduction -These are all introductions to Zig aimed at programmers with different backgrounds. +## Introducció +Totes aquestes són introduccions a Zig dirigides a programadors amb diferents experiències. -- [In-depth Overview](./overview/) -Here's an in-depth feature overview of Zig from a systems-programming perspective. -- [Why Zig When There is Already C++, D, and Rust?](./why_zig_rust_d_cpp/) -An introduction to Zig for C++, D, and Rust programmers. -- [Code Examples](./samples/) -A list of snippets to get a feeling for how Zig code looks. -- [Tools](./tools/) -A list of useful tools that can help you write Zig code. +- [Visió general a fons](./overview/) +Aquí teniu una visió general de les característiques de Zig des d'una perspectiva de programació de sistemes. +- [Per què Zig quan ja hi ha C++, D i Rust?](./why_zig_rust_d_cpp/) +Una introducció a Zig per a programadors de C++, D i Rust. +- [Exemples de codi](./samples/) +Una llista de fragments per fer-se una idea de com és el codi Zig. +- [Eines](./tools/) +Una llista d'eines útils que us poden ajudar a escriure codi Zig. -## Getting started -If you're ready to start programming in Zig, this guide will help you setup your environment. +## Primers passos +Si esteu preparats per començar a programar en Zig, aquesta guia us ajudarà a configurar el vostre entorn. -- [Getting started](./getting-started) +- [Primers passos](./getting-started) -## Online learning resources -- [Introduction to Zig: a project-based book](https://github.com/pedropark99/zig-book) -An open, technical and introductory book for Zig. +## Recursos d'aprenentatge en línia +- [Introducció a Zig: un llibre basat en projectes](https://github.com/pedropark99/zig-book) +Un llibre obert, tècnic i introductori per a Zig. - [zig.guide](https://zig.guide) -A structured introduction to Zig by [Sobeston](https://github.com/sobeston). +Una introducció estructurada a Zig per [Sobeston](https://github.com/sobeston). - [Ziglings](https://ziglings.org) -Learn Zig by fixing tiny broken programs. -- [Zig on Exercism](https://exercism.org/tracks/zig) -Solve coding exercises and get mentored to develop fluency in Zig. -- [Learning Zig](https://www.openmymind.net/learning_zig/) -Short introduction to Zig well suited for developers coming from garbage-collected languages. - -## Relevant videos and blog posts -- [Road to Zig 1.0](https://www.youtube.com/watch?v=Gv2I7qTux7g) [video] -Video by [Andrew Kelley](https://andrewkelley.me) introducing Zig and its philosophy. -- [Zig's New Relationship with LLVM](https://kristoff.it/blog/zig-new-relationship-llvm/) -A blog post about the work towards building the Zig self-hosted compiler, also featured in [an article by lwn.net](https://lwn.net/Articles/833400/). +Aprèn Zig arreglant petits programes trencats. +- [Zig a Exercism](https://exercism.org/tracks/zig) +Resol exercicis de codificació i rep orientació per desenvolupar fluïdesa en Zig. +- [Aprenent Zig](https://www.openmymind.net/learning_zig/) +Breu introducció a Zig molt adequada per a desenvolupadors que provenen de llenguatges amb recol·lector d'escombraries. + +## Vídeos i entrades de bloc rellevants +- [Road to Zig 1.0](https://www.youtube.com/watch?v=Gv2I7qTux7g) [vídeo] +Vídeo d'[Andrew Kelley](https://andrewkelley.me) que presenta Zig i la seva filosofia. +- [La nova relació de Zig amb LLVM](https://kristoff.it/blog/zig-new-relationship-llvm/) +Una entrada de bloc sobre el treball per construir el compilador autoallotjat de Zig, també presentat en [un article de lwn.net](https://lwn.net/Articles/833400/). diff --git a/content/ca-ES/learn/overview.smd b/content/ca-ES/learn/overview.smd index b4841cd47..88ce99841 100644 --- a/content/ca-ES/learn/overview.smd +++ b/content/ca-ES/learn/overview.smd @@ -1,20 +1,20 @@ --- -.title = "Overview", +.title = "Visió general", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "page.shtml", .custom = { - "mobile_menu_title": "Overview", + "mobile_menu_title": "Visió general", }, --- -# Feature Highlights -## [Small, simple language]($heading.id('small-simple-language')) +# Característiques destacades +## [Llenguatge petit i senzill]($heading.id('small-simple-language')) -Focus on debugging your application rather than debugging your programming language knowledge. +Concentreu-vos a depurar la vostra aplicació en lloc de depurar els vostres coneixements del llenguatge de programació. -Zig's entire syntax is specified with a [580-line PEG grammar file](https://ziglang.org/documentation/master/#Grammar). +La sintaxi completa de Zig està especificada en un [fitxer de gramàtica PEG de 580 línies](https://ziglang.org/documentation/master/#Grammar). -There is **no hidden control flow**, no hidden memory allocations, no preprocessor, and no macros. If Zig code doesn't look like it's jumping away to call a function, then it isn't. This means you can be sure that the following code calls only `foo()` and then `bar()`, and this is guaranteed without needing to know the types of anything: +No hi ha **flux de control ocult**, ni assignacions de memòria ocultes, ni preprocessador ni macros. Si el codi Zig no sembla que estigui saltant per cridar una funció, és que no ho fa. Això vol dir que podeu estar segurs que el codi següent només crida `foo()` i després `bar()`, i això està garantit sense necessitat de conèixer cap tipus: ```zig var a = b + c.d; @@ -22,60 +22,60 @@ foo(); bar(); ``` -Examples of hidden control flow: +Exemples de flux de control ocult: -- D has `@property` functions, which are methods that you call with what looks like field access, so in the above example, `c.d` might call a function. -- C++, D, and Rust have operator overloading, so the `+` operator might call a function. -- C++, D, and Go have throw/catch exceptions, so `foo()` might throw an exception, and prevent `bar()` from being called. +- D té funcions `@property`, que són mètodes als quals es crida aparentment accedint a un camp; per tant, en l'exemple anterior, `c.d` podria cridar una funció. +- C++, D i Rust tenen sobrecàrrega d'operadors, així que l'operador `+` podria cridar una funció. +- C++, D i Go tenen excepcions throw/catch, de manera que `foo()` podria llençar una excepció i evitar que es cridi `bar()`. - Zig promotes code maintenance and readability by making all control flow managed exclusively with language keywords and function calls. +Zig afavoreix el manteniment i la llegibilitat del codi fent que tot el flux de control es gestioni exclusivament amb paraules clau del llenguatge i crides a funcions. -## [Performance and Safety: Choose Two]($heading.id('performance-and-safety-choose-two')) +## [Rendiment i seguretat: trieu-ne dos]($heading.id('performance-and-safety-choose-two')) -Zig has four [build modes](https://ziglang.org/documentation/master/#Build-Mode), and they can all be mixed and matched all the way down to [scope granularity](https://ziglang.org/documentation/master/#setRuntimeSafety). +Zig disposa de quatre [modes de compilació](https://ziglang.org/documentation/master/#Build-Mode), i es poden combinar fins a [granularitat de bloc](https://ziglang.org/documentation/master/#setRuntimeSafety). -| Parameter | [Debug](https://ziglang.org/documentation/master/#Debug) | [ReleaseSafe](https://ziglang.org/documentation/master/#ReleaseSafe) | [ReleaseFast](https://ziglang.org/documentation/master/#ReleaseFast) | [ReleaseSmall](https://ziglang.org/documentation/master/#ReleaseSmall) | +| Paràmetre | [Debug](https://ziglang.org/documentation/master/#Debug) | [ReleaseSafe](https://ziglang.org/documentation/master/#ReleaseSafe) | [ReleaseFast](https://ziglang.org/documentation/master/#ReleaseFast) | [ReleaseSmall](https://ziglang.org/documentation/master/#ReleaseSmall) | |-----------|-------|-------------|-------------|--------------| -Optimizations - improve speed, harm debugging, harm compile time | | On | On | On | -Runtime Safety Checks - harm speed, harm size, crash instead of undefined behavior | On | On | | | +Optimitzacions - milloren la velocitat, dificulten la depuració, allarguen el temps de compilació | | On | On | On | +Comprovacions de seguretat en temps d'execució - perjudiquen la velocitat, augmenten la mida, fallen en lloc de provocar comportament indefinit | On | On | | | -Here is what [Integer Overflow](https://ziglang.org/documentation/master/#Integer-Overflow) looks like at compile time, regardless of the build mode: +Així és com es veu el [desbordament d'enters](https://ziglang.org/documentation/master/#Integer-Overflow) en temps de compilació, sigui quin sigui el mode: []($code.language('=html').buildAsset('features/1-integer-overflow.zig')) -Here is what it looks like at runtime, in safety-checked builds: +Així és com es veu en temps d'execució, en compilacions amb comprovacions de seguretat: []($code.language('=html').buildAsset('features/2-integer-overflow-runtime.zig')) -Those [stack traces work on all targets](#stack-traces-on-all-targets), including [freestanding](https://andrewkelley.me/post/zig-stack-traces-kernel-panic-bare-bones-os.html). +Aquestes [traces de pila funcionen a tots els objectius](#stack-traces-on-all-targets), incloent-hi entorns [freestanding](https://andrewkelley.me/post/zig-stack-traces-kernel-panic-bare-bones-os.html). -With Zig one can rely on a safety-enabled build mode, and selectively disable safety at the performance bottlenecks. For example the previous example could be modified like this: +Amb Zig podeu compilar en un mode amb seguretat activada, i desactivar-la selectivament als colls d'ampolla de rendiment. Per exemple, l'exemple anterior es podria modificar així: []($code.language('=html').buildAsset('features/3-undefined-behavior.zig')) -Zig uses [Illegal Behavior](https://ziglang.org/documentation/master/#Illegal-Behavior) as a razor sharp tool for both bug prevention and performance enhancement. +Zig utilitza el [comportament il·legal](https://ziglang.org/documentation/master/#Illegal-Behavior) com una eina precisa tant per prevenir errors com per millorar el rendiment. -Speaking of performance, Zig is faster than C. +Parlant de rendiment, Zig és més ràpid que C. -- All Zig code lives in one compilation unit, optimized together. -- Carefully chosen illegal behavior. For example, in Zig both signed and unsigned integers have illegal behavior on overflow, contrasted to only signed integers in C. This [facilitates optimizations that are not available in C](https://godbolt.org/z/vhjv9oM1W). -- Zig directly exposes a [SIMD vector type](https://ziglang.org/documentation/master/#Vectors), making it easy to write portable vectorized code. -- The standard library provides essential data structures such as hash maps and array lists, whereas in C it is tempting to use linked lists for simplicity. -- Advanced CPU features are enabled by default, unless [cross-compiling](#cross-compiling-is-a-first-class-use-case). +- Tot el codi Zig viu en una sola unitat de compilació, optimitzat conjuntament. +- Comportament il·legal escollit amb cura. Per exemple, en Zig tant els enters amb signe com els sense signe tenen comportament il·legal quan hi ha un desbordament, a diferència de C on només els enters amb signe el tenen. Això [facilita optimitzacions que no estan disponibles a C](https://godbolt.org/z/vhjv9oM1W). +- Zig exposa directament un [tipus vectorial SIMD](https://ziglang.org/documentation/master/#Vectors), cosa que facilita escriure codi vectoritzat portàtil. +- La biblioteca estàndard proporciona estructures de dades essencials com taules hash i llistes dinàmiques; en C sovint és temptador usar llistes enllaçades per simplicitat. +- Les funcions avançades de CPU s'activen per defecte, llevat que s'estigui [compilant en creuat](#cross-compiling-is-a-first-class-use-case). -Please note that Zig is not a fully safe language. For those interested in following Zig's safety story, subscribe to these issues: +Tingueu en compte que Zig no és un llenguatge completament segur. Si voleu seguir l'evolució de la seguretat de Zig, podeu subscriure-us a aquestes incidències: -- [enumerate all kinds of undefined behavior, even that which cannot be safety-checked](https://github.com/ziglang/zig/issues/1966) -- [make Debug and ReleaseSafe modes fully safe](https://github.com/ziglang/zig/issues/2301) +- [enumerar totes les classes de comportament indefinit, fins i tot les que no es poden comprovar amb seguretat](https://github.com/ziglang/zig/issues/1966) +- [fer que els modes Debug i ReleaseSafe siguin completament segurs](https://github.com/ziglang/zig/issues/2301) -## Zig competes with C instead of depending on it +## Zig competeix amb C en lloc de dependre'n -The Zig Standard Library integrates with libc, but does not depend on it. Here's Hello World: +La biblioteca estàndard de Zig s'integra amb libc, però no en depèn. Aquí teniu un Hello World: []($code.language('=html').buildAsset('features/4-hello.zig')) -When compiled with `-O ReleaseSmall`, debug symbols stripped, single-threaded mode, this produces a 9.8 KiB static executable for the x86_64-linux target: +Quan es compila amb `-O ReleaseSmall`, eliminant els símbols de depuració i en mode d'un sol fil, se'n genera un executable estàtic de 9.8 KiB per a l'objectiu x86_64-linux: ``` $ zig build-exe hello.zig -O ReleaseSmall -fstrip -fsingle-threaded $ wc -c hello @@ -84,7 +84,7 @@ $ ldd hello not a dynamic executable ``` -A Windows build is even smaller, coming out to 4096 bytes: +En Windows, la compilació és encara més petita, només 4096 bytes: ``` $ zig build-exe hello.zig -O ReleaseSmall -fstrip -fsingle-threaded -target x86_64-windows $ wc -c hello.exe @@ -93,121 +93,121 @@ $ file hello.exe hello.exe: PE32+ executable (console) x86-64, for MS Windows ``` -## Order independent top level declarations +## Declaracions de nivell superior independents de l'ordre -Top level declarations such as global variables are order-independent and lazily analyzed. The initialization values of global variables are [evaluated at compile-time](#compile-time-reflection-and-compile-time-code-execution). +Les declaracions de nivell superior, com ara les variables globals, són independents de l'ordre i s'analitzen de manera mandrosa. Els valors d'inicialització de les variables globals s'[avaluen en temps de compilació](#compile-time-reflection-and-compile-time-code-execution). []($code.language('=html').buildAsset('features/5-global-variables.zig')) -## Optional type instead of null pointers +## Tipus opcional en lloc de punters nuls -In other programming languages, null references are the source of many runtime exceptions, and even stand accused of being [the worst mistake of computer science](https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/). +En altres llenguatges de programació, les referències nul·les són la font de moltes excepcions en temps d'execució, i fins i tot són acusades de ser [el pitjor error de la informàtica](https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/). -Unadorned Zig pointers cannot be null: +Els punters Zig sense adorns no poden ser nuls: []($code.language('=html').buildAsset('features/6-null-to-ptr.zig')) -However any type can be made into an [optional type](https://ziglang.org/documentation/master/#Optionals) by prefixing it with `?`: +Tanmateix, qualsevol tipus es pot convertir en un [tipus opcional](https://ziglang.org/documentation/master/#Optionals) prefixant-lo amb `?`: []($code.language('=html').buildAsset('features/7-optional-syntax.zig')) -To unwrap an optional value, one can use `orelse` to provide a default value: +Per desempaquetar un valor opcional, es pot usar `orelse` per proporcionar un valor per defecte: []($code.language('=html').buildAsset('features/8-optional-orelse.zig')) -Another option is to use if: +Una altra opció és usar `if`: []($code.language('=html').buildAsset('features/9-optional-if.zig')) - The same syntax works with [while](https://ziglang.org/documentation/master/#while): +La mateixa sintaxi funciona amb [while](https://ziglang.org/documentation/master/#while): []($code.language('=html').buildAsset('features/10-optional-while.zig')) -## Manual memory management +## Gestió manual de la memòria -A library written in Zig is eligible to be used anywhere: +Una biblioteca escrita en Zig es pot utilitzar a qualsevol lloc: -- [Desktop applications](https://github.com/TM35-Metronome/) -- Low latency servers -- [Operating System kernels](https://github.com/AndreaOrru/zen) -- [Embedded devices](https://github.com/skyfex/zig-nrf-demo/) -- Real-time software, e.g. live performances, airplanes, pacemakers -- [In web browsers or other plugins with WebAssembly](https://shritesh.github.io/zigfmt-web/) -- By other programming languages, using the C ABI +- [Aplicacions d'escriptori](https://github.com/TM35-Metronome/) +- Servidors de baixa latència +- [Nuclis de sistemes operatius](https://github.com/AndreaOrru/zen) +- [Dispositius encastats](https://github.com/skyfex/zig-nrf-demo/) +- Programari en temps real, per exemple actuacions en directe, avions, marcapassos +- [En navegadors web o altres connectors amb WebAssembly](https://shritesh.github.io/zigfmt-web/) +- Des d'altres llenguatges, utilitzant l'ABI de C -In order to accomplish this, Zig programmers must manage their own memory, and must handle memory allocation failure. +Per aconseguir-ho, els programadors de Zig han de gestionar la memòria ells mateixos i han de tractar els errors d'assignació. -This is true of the Zig Standard Library as well. Any functions that need to allocate memory accept an allocator parameter. As a result, the Zig Standard Library can be used even for the freestanding target. +Això també és cert per a la biblioteca estàndard de Zig. Qualsevol funció que hagi d'assignar memòria accepta un paràmetre d'assignador. Com a resultat, la biblioteca estàndard de Zig es pot utilitzar fins i tot en l'objectiu freestanding. -In addition to [A fresh take on error handling](#a-fresh-take-on-error-handling), Zig provides [defer](https://ziglang.org/documentation/master/#defer) and [errdefer](https://ziglang.org/documentation/master/#errdefer) to make all resource management - not only memory - simple and easily verifiable. +A més de [Una nova mirada a la gestió d'errors](#a-fresh-take-on-error-handling), Zig proporciona [defer](https://ziglang.org/documentation/master/#defer) i [errdefer](https://ziglang.org/documentation/master/#errdefer) per fer que la gestió de recursos (no només la memòria) sigui senzilla i fàcil de verificar. -For an example of `defer`, see [Integration with C libraries without FFI/bindings](#integration-with-c-libraries-without-ffibindings). Here is an example of using `errdefer`: +Per a un exemple de `defer`, vegeu [Integració amb biblioteques de C sense FFI/bindings](#integration-with-c-libraries-without-ffibindings). Aquí teniu un exemple d'ús d'`errdefer`: []($code.language('=html').buildAsset('features/11-errdefer.zig')) -## [A fresh take on error handling]($heading.id('a-fresh-take-on-error-handling')) +## [Una nova mirada a la gestió d'errors]($heading.id('a-fresh-take-on-error-handling')) -Errors are values, and may not be ignored: +Els errors són valors, i no es poden ignorar: []($code.language('=html').buildAsset('features/12-errors-as-values.zig')) -Errors can be handled with [catch](https://ziglang.org/documentation/master/#catch): +Els errors es poden gestionar amb [catch](https://ziglang.org/documentation/master/#catch): []($code.language('=html').buildAsset('features/13-errors-catch.zig')) -The keyword [try](https://ziglang.org/documentation/master/#try) is a shortcut for `catch |err| return err`: +La paraula clau [try](https://ziglang.org/documentation/master/#try) és una drecera de `catch |err| return err`: []($code.language('=html').buildAsset('features/14-errors-try.zig')) -Note that is an [Error Return Trace](https://ziglang.org/documentation/master/#Error-Return-Traces), not a [stack trace](#stack-traces-on-all-targets). The code did not pay the price of unwinding the stack to come up with that trace. +Tingueu en compte que és una [traça de retorn d'errors](https://ziglang.org/documentation/master/#Error-Return-Traces), no una [traça de pila](#stack-traces-on-all-targets). El codi no ha pagat el cost de desenrotllar la pila per obtenir aquesta traça. -The [switch](https://ziglang.org/documentation/master/#switch) keyword used on an error ensures that all possible errors are handled: +La paraula clau [switch](https://ziglang.org/documentation/master/#switch) aplicada a un error garanteix que s'han gestionat tots els errors possibles: []($code.language('=html').buildAsset('features/15-errors-switch.zig')) -The keyword [unreachable](https://ziglang.org/documentation/master/#unreachable) is used to assert that no errors will occur: +La paraula clau [unreachable](https://ziglang.org/documentation/master/#unreachable) s'utilitza per afirmar que no es produiran errors: []($code.language('=html').buildAsset('features/16-unreachable.zig')) -This invokes [undefined behavior](#performance-and-safety-choose-two) in the unsafe build modes, so be sure to use it only when success is guaranteed. +Això invoca [comportament indefinit](#performance-and-safety-choose-two) en els modes de compilació sense seguretat, així que assegureu-vos d'utilitzar-la només quan l'èxit estigui garantit. -### [Stack traces on all targets]($heading.id("stack-traces-on-all-targets")) +### [Traces de pila a tots els objectius]($heading.id("stack-traces-on-all-targets")) -The stack traces and [error return traces](https://ziglang.org/documentation/master/#Error-Return-Traces) shown on this page work on all Tier 1 Support and some Tier 2 Support targets. [Even freestanding](https://andrewkelley.me/post/zig-stack-traces-kernel-panic-bare-bones-os.html)! +Les traces de pila i les [traces de retorn d'errors](https://ziglang.org/documentation/master/#Error-Return-Traces) mostrades en aquesta pàgina funcionen a tots els objectius de Suport de Nivell 1 i alguns de Nivell 2. [Fins i tot en freestanding](https://andrewkelley.me/post/zig-stack-traces-kernel-panic-bare-bones-os.html)! -In addition, the standard library has the ability to capture a stack trace at any point and then dump it to standard error later: +A més, la biblioteca estàndard pot capturar una traça de pila en qualsevol punt i abocar-la a la sortida d'errors més tard: []($code.language('=html').buildAsset('features/17-stack-traces.zig')) -The standard library's DebugAllocator uses this technique to report leaks and double frees. +L'assignador DebugAllocator de la biblioteca estàndard utilitza aquesta tècnica per informar de fuites i alliberaments dobles. -## Generic data structures and functions +## Estructures de dades genèriques i funcions -Types are values that must be known at compile-time: +Els tipus són valors que s'han de conèixer en temps de compilació: []($code.language('=html').buildAsset('features/18-types.zig')) -A generic data structure is simply a function that returns a `type`: +Una estructura de dades genèrica és simplement una funció que retorna un `type`: []($code.language('=html').buildAsset('features/19-generics.zig')) -## [Compile-time reflection and compile-time code execution]($heading.id('compile-time-reflection-and-compile-time-code-execution')) +## [Reflexió i execució de codi en temps de compilació]($heading.id('compile-time-reflection-and-compile-time-code-execution')) -The [@typeInfo](https://ziglang.org/documentation/master/#typeInfo) builtin function provides reflection: +La funció [@typeInfo](https://ziglang.org/documentation/master/#typeInfo) proporciona reflexió: []($code.language('=html').buildAsset('features/20-reflection.zig')) -The Zig Standard Library uses this technique to implement formatted printing. Despite being a [Small, simple language](#small-simple-language), Zig's formatted printing is implemented entirely in Zig. Meanwhile, in C, compile errors for printf are hard-coded into the compiler. Similarly, in Rust, the formatted printing macro is hard-coded into the compiler. +La biblioteca estàndard de Zig utilitza aquesta tècnica per implementar la impressió formatada. Tot i ser un [llenguatge petit i senzill](#small-simple-language), la impressió formatada de Zig està implementada íntegrament en Zig. Mentrestant, en C, els errors de compilació de printf estan codificats al compilador. De manera similar, a Rust la macro d'impressió formatada està codificada al compilador. -Zig can also evaluate functions and blocks of code at compile-time. In some contexts, such as global variable initializations, the expression is implicitly evaluated at compile-time. Otherwise, one can explicitly evaluate code at compile-time with the [comptime](https://ziglang.org/documentation/master/#comptime) keyword. This can be especially powerful when combined with assertions: +Zig també pot avaluar funcions i blocs de codi en temps de compilació. En alguns contextos, com la inicialització de variables globals, l'expressió s'avalua implícitament en temps de compilació. En cas contrari, es pot avaluar explícitament codi en temps de compilació amb la paraula clau [comptime](https://ziglang.org/documentation/master/#comptime). Això pot ser especialment potent combinat amb asserts: []($code.language('=html').buildAsset('features/21-comptime.zig')) -## [Integration with C libraries without FFI/bindings]($heading.id('integration-with-c-libraries-without-ffibindings')) +## [Integració amb biblioteques de C sense FFI/bindings]($heading.id('integration-with-c-libraries-without-ffibindings')) -[@cImport](https://ziglang.org/documentation/master/#cImport) directly imports types, variables, functions, and simple macros for use in Zig. It even translates inline functions from C into Zig. +[@cImport](https://ziglang.org/documentation/master/#cImport) importa directament tipus, variables, funcions i macros simples per utilitzar-los a Zig. Fins i tot tradueix funcions inline de C a Zig. -Here is an example of emitting a sine wave using [libsoundio](http://libsound.io/): +Aquí teniu un exemple d'emissió d'una ona sinusoidal amb [libsoundio](http://libsound.io/): sine.zig []($code.language('=html').buildAsset('features/22-sine-wave.zig')) @@ -219,13 +219,13 @@ Output device: Built-in Audio Analog Stereo ^C ``` -[This Zig code is significantly simpler than the equivalent C code](https://gist.github.com/andrewrk/d285c8f912169329e5e28c3d0a63c1d8), as well as having more safety protections, and all this is accomplished by directly importing the C header file - no API bindings. +[Aquest codi Zig és significativament més senzill que l'equivalent en C](https://gist.github.com/andrewrk/d285c8f912169329e5e28c3d0a63c1d8), a més de tenir més proteccions de seguretat, i tot això s'aconsegueix important directament l'encapçalament de C, sense bindings d'API. -*Zig is better at using C libraries than C is at using C libraries.* +*Zig és millor usant biblioteques de C que el mateix C.* -### [Zig is also a C compiler]($heading.id('zig-is-also-a-c-compiler')) +### [Zig també és un compilador de C]($heading.id('zig-is-also-a-c-compiler')) -Here's an example of Zig building some C code: +Aquí teniu un exemple de Zig compilant codi C: hello.c ```c @@ -243,13 +243,13 @@ $ ./hello Hello world ``` -You can use `--verbose-cc` to see what C compiler command this executed: +Podeu usar `--verbose-cc` per veure quina ordre del compilador C s'ha executat: ``` $ zig build-exe hello.c -lc --verbose-cc zig cc -MD -MV -MF .zig-cache/tmp/42zL6fBH8fSo-hello.o.d -nostdinc -fno-spell-checking -isystem /home/andy/dev/zig/build/lib/zig/include -isystem /home/andy/dev/zig/build/lib/zig/libc/include/x86_64-linux-gnu -isystem /home/andy/dev/zig/build/lib/zig/libc/include/generic-glibc -isystem /home/andy/dev/zig/build/lib/zig/libc/include/x86_64-linux-any -isystem /home/andy/dev/zig/build/lib/zig/libc/include/any-linux-any -march=native -g -fstack-protector-strong --param ssp-buffer-size=4 -fno-omit-frame-pointer -o .zig-cache/tmp/42zL6fBH8fSo-hello.o -c hello.c -fPIC ``` -Note that if you run the command again, there is no output, and it finishes instantly: +Fixeu-vos que si executeu l'ordre un altre cop, no hi ha cap sortida i acaba instantàniament: ``` $ time zig build-exe hello.c -lc --verbose-cc @@ -258,28 +258,28 @@ user 0m0.018s sys 0m0.009s ``` -This is thanks to [Build Artifact Caching](https://ziglang.org/download/0.4.0/release-notes.html#Build-Artifact-Caching). Zig automatically parses the .d file using a robust caching system to avoid duplicating work. +Això és gràcies a la [Memòria cau d'artefactes de compilació](https://ziglang.org/download/0.4.0/release-notes.html#Build-Artifact-Caching). Zig analitza automàticament el fitxer .d amb un sistema de memòria cau robust per evitar repetir feina. -Not only can Zig compile C code, but there is a very good reason to use Zig as a C compiler: [Zig ships with libc](#zig-ships-with-libc). +No només Zig pot compilar codi C, sinó que hi ha una molt bona raó per fer servir Zig com a compilador de C: [Zig inclou libc](#zig-ships-with-libc). -### Export functions, variables, and types for C code to depend on +### Exportar funcions, variables i tipus perquè el codi C hi depengui -One of the primary use cases for Zig is exporting a library with the C ABI for other programming languages to call into. The `export` keyword in front of functions, variables, and types causes them to be part of the library API: +Un dels casos d'ús principals de Zig és exportar una biblioteca amb l'ABI de C perquè altres llenguatges hi puguin cridar. La paraula clau `export` davant de funcions, variables i tipus fa que formin part de l'API de la biblioteca: mathtest.zig []($code.language('=html').buildAsset('features/23-math-test.zig')) -To make a static library: +Per fer una biblioteca estàtica: ``` $ zig build-lib mathtest.zig ``` -To make a shared library: +Per fer una biblioteca compartida: ``` $ zig build-lib mathtest.zig -dynamic ``` -Here is an example with the [Zig Build System](#zig-build-system): +Aquí teniu un exemple amb el [Sistema de compilació de Zig](#zig-build-system): test.c ```c @@ -301,13 +301,13 @@ $ zig build test 1379 ``` -## [Cross-compiling is a first-class use case]($heading.id('cross-compiling-is-a-first-class-use-case')) +## [La compilació creuada és un cas d'ús de primera classe]($heading.id('cross-compiling-is-a-first-class-use-case')) -Zig can build for any of the targets from the Support Table (see latest release notes) with Tier 3 Support or better. No "cross toolchain" needs to be installed or anything like that. Here's a native Hello World: +Zig pot compilar per a qualsevol objectiu de la Taula de Suport (vegeu les notes de l'última versió) amb Suport de Nivell 3 o superior. No cal instal·lar cap "toolchain de compilació creuada" ni res per l'estil. Aquí hi ha un Hello World nadiu: []($code.language('=html').buildAsset('features/4-hello.zig')) -Now to build it for x86_64-windows, x86_64-macos, and aarch64-linux: +Ara per compilar-lo per a x86_64-windows, x86_64-macos i aarch64-linux: ``` $ zig build-exe hello.zig -target x86_64-windows $ file hello.exe @@ -320,11 +320,11 @@ $ file hello hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, with debug_info, not stripped ``` -This works on any Tier 3+ target, for any Tier 3+ target. +Això funciona des de qualsevol objectiu de Nivell 3+ cap a qualsevol altre objectiu de Nivell 3+. -### [Zig ships with libc]($heading.id('zig-ships-with-libc')) +### [Zig inclou libc]($heading.id('zig-ships-with-libc')) -You can find the available libc targets with `zig targets`: +Podeu veure els objectius libc disponibles amb `zig targets`: ``` ... .libc = .{ @@ -428,9 +428,9 @@ You can find the available libc targets with `zig targets`: ... ``` -What this means is that `-lc` for these targets *does not depend on any system files*! +Això vol dir que `-lc` per a aquests objectius *no depèn de cap fitxer del sistema*! -Let's look at that [C hello world example](#zig-is-also-a-c-compiler) again: +Tornem a mirar l'[exemple de C hello world](#zig-is-also-a-c-compiler): ``` $ zig build-exe hello.c -lc $ ./hello @@ -445,7 +445,7 @@ $ ldd ./hello /lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007fc4b6672000) ``` -[glibc](https://www.gnu.org/software/libc/) does not support building statically, but [musl](https://www.musl-libc.org/) does: +[glibc](https://www.gnu.org/software/libc/) no admet compilació estàtica, però [musl](https://www.musl-libc.org/) sí: ``` $ zig build-exe hello.c -lc -target x86_64-linux-musl $ ./hello @@ -454,26 +454,26 @@ $ ldd hello not a dynamic executable ``` -In this example, Zig built musl libc from source and then linked against it. The build of musl libc for x86_64-linux remains available thanks to the [caching system](https://ziglang.org/download/0.4.0/release-notes.html#Build-Artifact-Caching), so any time this libc is needed again it will be available instantly. +En aquest exemple, Zig va compilar musl libc des del codi font i després hi va enllaçar. La compilació de musl libc per a x86_64-linux queda disponible gràcies al [sistema de memòria cau](https://ziglang.org/download/0.4.0/release-notes.html#Build-Artifact-Caching), de manera que sempre que torni a caldre aquest libc estarà disponible instantàniament. -This means that this functionality is available on any platform. Windows and macOS users can build Zig and C code, and link against libc, for any of the targets listed above. Similarly code can be cross compiled for other architectures: +Això vol dir que aquesta funcionalitat és disponible en qualsevol plataforma. Els usuaris de Windows i macOS poden compilar codi Zig i C, i enllaçar amb libc, per a qualsevol dels objectius de la llista anterior. De manera similar, es pot compilar en creuat per a altres arquitectures: ``` $ zig build-exe hello.c -lc -target aarch64-linux-gnu $ file hello hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 2.0.0, with debug_info, not stripped ``` -In some ways, Zig is a better C compiler than C compilers! +En alguns aspectes, Zig és un millor compilador de C que els compiladors de C! -This functionality is more than bundling a cross-compilation toolchain along with Zig. For example, the total size of libc headers that Zig ships is 22 MiB uncompressed. Meanwhile, the headers for musl libc + linux headers on x86_64 alone are 8 MiB, and for glibc are 3.1 MiB (glibc is missing the linux headers), yet Zig currently ships with 40 libcs. With a naive bundling that would be 444 MiB. However, thanks to this [process_headers tool](https://github.com/ziglang/zig/blob/0.4.0/libc/process_headers.zig), and some [good old manual labor](https://github.com/ziglang/zig/wiki/Updating-libc), Zig binary tarballs remain roughly 30 MiB total, despite supporting libc for all these targets, as well as compiler-rt, libunwind, and libcxx, and despite being a clang-compatible C compiler. For comparison, the Windows binary build of clang 8.0.0 itself from llvm.org is 132 MiB. +Aquesta funcionalitat va més enllà d'empaquetar un conjunt d'eines de compilació creuada juntament amb Zig. Per exemple, la mida total dels fitxers d'encapçalaments libc que Zig inclou és de 22 MiB sense comprimir. Mentrestant, els encapçalaments de musl libc + encapçalaments de Linux per a x86_64 ocupen 8 MiB, i els de glibc 3.1 MiB (glibc no inclou els headers de Linux), i tot i això Zig inclou actualment 40 libc. Amb un empaquetat naïf això serien 444 MiB. Tanmateix, gràcies a l'[eina process_headers](https://github.com/ziglang/zig/blob/0.4.0/libc/process_headers.zig), i a una mica de [treball manual](https://github.com/ziglang/zig/wiki/Updating-libc), els tarballs binaris de Zig continuen sent d'uns 30 MiB en total, malgrat donar suport a libc per a tots aquests objectius, així com compiler-rt, libunwind i libcxx, i malgrat ser un compilador de C compatible amb clang. Per comparar, el paquet binari de clang 8.0.0 per a Windows des d'llvm.org ocupa 132 MiB. -Note that only the Tier 1 Support targets have been thoroughly tested. It is planned to [add more libcs](https://github.com/ziglang/zig/issues/514) (including for Windows), and to [add test coverage for building against all the libcs](https://github.com/ziglang/zig/issues/2058). +Només s'han provat a fons els objectius de Suport de Nivell 1. Està previst [afegir més libc](https://github.com/ziglang/zig/issues/514) (incloent-hi per a Windows) i [afegir cobertura de proves per compilar contra tots els libc](https://github.com/ziglang/zig/issues/2058). -It's [planned to have a Zig Package Manager](https://github.com/ziglang/zig/issues/943), but it's not done yet. One of the things that will be possible is to create a package for C libraries. This will make the [Zig Build System](#zig-build-system) attractive for Zig programmers and C programmers alike. +Està [previst tenir un gestor de paquets de Zig](https://github.com/ziglang/zig/issues/943), però encara no està fet. Una de les coses que serà possible és crear un paquet per a biblioteques de C. Això farà que el [Sistema de compilació de Zig](#zig-build-system) sigui atractiu tant per als programadors de Zig com per als de C. -## [Zig Build System]($heading.id('zig-build-system')) +## [Sistema de compilació de Zig]($heading.id('zig-build-system')) -Zig comes with a build system, so you don't need make, cmake, or anything like that. +Zig ve amb un sistema de compilació, de manera que no necessiteu make, cmake ni res per l'estil. ``` $ zig init info: created build.zig @@ -491,7 +491,7 @@ info: see `zig build --help` for a menu of options []($code.language('=html').buildAsset('features/26-build.zig')) -Let's have a look at that `--help` menu. +Fem un cop d'ull al menú `--help`. ``` $ zig build --help Usage: zig build [steps] [options] @@ -594,41 +594,36 @@ Advanced Options: --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features ``` -You can see that one of the available steps is run. +Podeu veure que un dels passos disponibles és `run`. ``` $ zig build run All your codebase are belong to us. Run `zig build test` to run the tests. ``` -Here are some example build scripts: +Aquests són alguns scripts de compilació d'exemple: -- [Build script of OpenGL Tetris game](https://github.com/andrewrk/tetris/blob/master/build.zig) -- [Build script of bare metal Raspberry Pi 3 arcade game](https://github.com/andrewrk/clashos/blob/master/build.zig) -- [Build script of self-hosted Zig compiler](https://github.com/ziglang/zig/blob/master/build.zig) +- [Script de compilació del joc de Tetris amb OpenGL](https://github.com/andrewrk/tetris/blob/master/build.zig) +- [Script de compilació del joc d'arcade bare metal per a Raspberry Pi 3](https://github.com/andrewrk/clashos/blob/master/build.zig) +- [Script de compilació del compilador Zig auto-hostatjat](https://github.com/ziglang/zig/blob/master/build.zig) -## Wide range of targets supported +## Ampli ventall d'objectius compatibles -Zig uses a "support tier" system to communicate the level of support for different targets. +Zig utilitza un sistema de "nivells de suport" per comunicar el nivell de suport de les diferents plataformes. -[Support Table as of Zig 0.15](https://ziglang.org/download/0.15.1/release-notes.html#Target-Support) +[Taula de suport a Zig 0.15](https://ziglang.org/download/0.15.1/release-notes.html#Target-Support) -## Friendly toward package maintainers +## Respectuós amb els mantenidors de paquets -Even though Zig is self-hosted, building from source only depends on system -C/C++ toolchain and LLVM, using standard CMake build steps thanks to -[a WebAssembly based bootstrap process](https://ziglang.org/news/goodbye-cpp/). +Tot i que Zig és autoallotjat, compilar-lo des del codi font només depèn d'una cadena d'eines C/C++ i LLVM, utilitzant passos de compilació estàndard de CMake gràcies a un [procés d'arrencada basat en WebAssembly](https://ziglang.org/news/goodbye-cpp/). -For those distributions that want to avoid binary blobs, there is a -well-documented set of steps to -[reproduce Zig without binaries](https://jakstys.lt/2024/zig-reproduced-without-binaries/). +Per a les distribucions que volen evitar binaris privatius, hi ha un conjunt de passos ben documentat per [reproduir Zig sense binaris](https://jakstys.lt/2024/zig-reproduced-without-binaries/). -In the future, we hope to inspire a third party to implement a Zig interpreter -written in C that can reduce this to O(1) step. +En el futur, esperem inspirar una tercera part a implementar un intèrpret de Zig escrit en C que redueixi això a O(1) passos. -As Maya Rashish notes, -[porting Zig to other platforms is fun and speedy](http://coypu.sdf.org/porting-zig.html). +Com assenyala Maya Rashish, +[portar Zig a altres plataformes és divertit i ràpid](http://coypu.sdf.org/porting-zig.html). -Non-debug [build modes](https://ziglang.org/documentation/master/#Build-Mode) are reproducible/deterministic. +Els [modes de compilació](https://ziglang.org/documentation/master/#Build-Mode) que no són de depuració són reproduïbles/deterministes. -There is a [JSON version of the download page](https://ziglang.org/download/index.json). +Hi ha una [versió JSON de la pàgina de descàrrega](https://ziglang.org/download/index.json). diff --git a/content/ca-ES/learn/samples.smd b/content/ca-ES/learn/samples.smd index 580c2e73e..ea0dbe05f 100644 --- a/content/ca-ES/learn/samples.smd +++ b/content/ca-ES/learn/samples.smd @@ -1,48 +1,48 @@ --- -.title = "Samples", +.title = "Exemples", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "page.shtml", .custom = { - "mobile_menu_title": "Samples", + "mobile_menu_title": "Exemples", "toc": true, }, --- -# [Hello world]($heading.id('hello')) -A minimal example printing hello world. +# [Hola món]($heading.id('hello')) +Un exemple mínim que imprimeix hola món. []($code.language('=html').buildAsset("samples/hello-world.zig")) -# [Calling external library functions]($heading.id('ext')) -All system API functions can be invoked this way, you do not need library bindings to interface them. +# [Cridar funcions de biblioteques externes]($heading.id('ext')) +Totes les funcions de l'API del sistema es poden invocar d'aquesta manera, no necessiteu enllaços de biblioteca per interactuar-hi. []($code.language('=html').buildAsset("samples/windows-msgbox.zig")) -# [Memory leak detection]($heading.id('leak')) -Using `std.heap.GeneralPurposeAllocator` you can track double frees and memory leaks. +# [Detecció de fuites de memòria]($heading.id('leak')) +Utilitzant `std.heap.GeneralPurposeAllocator` podeu fer un seguiment de les dobles alliberacions i les fuites de memòria. []($code.language('=html').buildAsset("samples/memory-leak.zig")) -# [C interoperability]($heading.id('c-interop')) -Example of importing a C header file and linking to both libc and raylib. +# [Interoperabilitat amb C]($heading.id('c-interop')) +Exemple d'importació d'un fitxer de capçalera C i enllaç tant amb libc com amb raylib. []($code.language('=html').buildAsset("samples/c-interop.zig")) # [Zigg Zagg]($heading.id('zigg-zagg')) -Zig is *optimized* for coding interviews (not really). +Zig està *optimitzat* per a entrevistes de programació (en realitat no). []($code.language('=html').buildAsset("samples/ziggzagg.zig")) -# [Generic Types]($heading.id('generic')) -In Zig types are comptime values and we use functions that return a type to implement generic algorithms and data structures. In this example we implement a simple generic queue and test its behaviour. +# [Tipus genèrics]($heading.id('generic')) +A Zig, els tipus són valors en temps de compilació i utilitzem funcions que retornen un tipus per implementar algorismes i estructures de dades genèriques. En aquest exemple implementem una cua genèrica simple i provem el seu comportament. []($code.language('=html').buildAsset("samples/generic-type.zig")) -# [Using cURL from Zig]($heading.id('curl')) +# [Utilitzar cURL des de Zig]($heading.id('curl')) []($code.language('=html').buildAsset("samples/curl.zig")) diff --git a/content/ca-ES/learn/tools.smd b/content/ca-ES/learn/tools.smd index c55a1ed87..41161e61b 100644 --- a/content/ca-ES/learn/tools.smd +++ b/content/ca-ES/learn/tools.smd @@ -1,21 +1,21 @@ --- -.title = "Tools", +.title = "Eines", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "page.shtml", .custom = { - "mobile_menu_title": "Tools", + "mobile_menu_title": "Eines", "toc": true, }, --- -# [Language Servers]($heading.id('lsp')) -Language servers are editor-agnostic tools for obtaining syntax highlighting, autocompletion, and many other features. Consider using a Language server over a syntax-highlighting extension for a richer development experience. +# [Servidors de llenguatge]($heading.id('lsp')) +Els servidors de llenguatge són eines independents de l'editor per obtenir ressaltat de sintaxi, autocompletar i moltes altres funcions. Considereu utilitzar un servidor de llenguatge en lloc d'una extensió de ressaltat de sintaxi per a una experiència de desenvolupament més rica. - [zigtools/zls](https://github.com/zigtools/zls) -# [Text Editors]($heading.id('editors')) -Editor-specific tools, mostly syntax highlighters. +# [Editors de text]($heading.id('editors')) +Eines específiques de l'editor, principalment ressaltadors de sintaxi. ## VS Code - [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) @@ -35,7 +35,7 @@ Editor-specific tools, mostly syntax highlighters. ## Kate - [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) -## JetBrains family (IntelliJ IDEA, Fleet) +## Família JetBrains (IntelliJ IDEA, Fleet) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) - [Zig Fleet Plugin](https://plugins.jetbrains.com/plugin/26070-zig) diff --git a/content/ca-ES/learn/why_zig_rust_d_cpp.smd b/content/ca-ES/learn/why_zig_rust_d_cpp.smd index 98b9066cb..53ad385b8 100644 --- a/content/ca-ES/learn/why_zig_rust_d_cpp.smd +++ b/content/ca-ES/learn/why_zig_rust_d_cpp.smd @@ -1,16 +1,16 @@ --- -.title = "Why Zig When There is Already C++, D, and Rust?", +.title = "Per què Zig quan ja hi ha C++, D i Rust?", .author = "", .date = @date("2024-08-07:00:00:00"), .layout = "page.shtml", .custom = { - "mobile_menu_title": "Why Zig?", + "mobile_menu_title": "Per què Zig?", }, --- -# No hidden control flow +# Sense flux de control ocult -If Zig code doesn't look like it's jumping away to call a function, then it isn't. This means you can be sure that the following code calls only `foo()` and then `bar()`, and this is guaranteed without needing to know the types of anything: +Si el codi Zig no sembla que estigui saltant per cridar una funció, vol dir que no ho fa. Això significa que podeu estar segurs que el codi següent crida només `foo()` i després `bar()`, i això està garantit sense necessitat de conèixer els tipus de res: ```zig var a = b + c.d; @@ -18,141 +18,147 @@ foo(); bar(); ``` -Examples of hidden control flow: - -* D has `@property` functions, which are methods that you call with what looks like field access, so in the above example, `c.d` might call a function. -* C++, D, and Rust have operator overloading, so the `+` operator might call a function. -* C++, D, and Go have throw/catch exceptions (sometimes also called panic/recover), so `foo()` might throw an exception, and prevent `bar()` from being called. (Of course, even in Zig `foo()` could deadlock and prevent `bar()` from being called, but that can happen in any Turing-complete language.) - -The purpose of this design decision is to improve readability. - -# No hidden allocations - -Zig has a hands-off approach when it comes to heap allocation. There is no `new` keyword -or any other language feature that uses a heap allocator (e.g. string concatenation operator[1]). -The entire concept of the heap is managed by library and application code, not by the language. - -Examples of hidden allocations: - -* Go's `defer` allocates memory to a function-local stack. In addition to being an unintuitive - way for this control flow to work, it can cause out-of-memory failures if you use - `defer` inside a loop. -* C++ coroutines allocate heap memory in order to call a coroutine. -* In Go, a function call can cause heap allocation because goroutines allocate small stacks - that get resized when the call stack gets deep enough. -* The main Rust standard library APIs panic on out of memory conditions, and the alternate - APIs that accept allocator parameters are an afterthought - (see [rust-lang/rust#29802](https://github.com/rust-lang/rust/issues/29802)). - -Nearly all garbage collected languages have hidden allocations strewn about, since the -garbage collector hides the evidence on the cleanup side. - -The main problem with hidden allocations is that it prevents the *reusability* of a -piece of code, unnecessarily limiting the number of environments that code would be -appropriate to be deployed to. Simply put, there are use cases where one must be able -to rely on control flow and function calls not to have the side-effect of memory allocation, -therefore a programming language can only serve these use cases if it can realistically -provide this guarantee. - -In Zig, there are standard library features that provide and work with heap allocators, -but those are optional standard library features, not built into the language itself. -If you never initialize a heap allocator, you can be confident your program will not heap allocate. - -Every standard library feature that needs to allocate heap memory accepts an `Allocator` parameter -in order to do it. This means that the Zig standard library supports freestanding targets. For -example `std.ArrayList` and `std.AutoHashMap` can be used for bare metal programming! - -Custom allocators make manual memory management a breeze. Zig has a debug allocator that -maintains memory safety in the face of use-after-free and double-free. It automatically -detects and prints stack traces of memory leaks. There is an arena allocator so that you can -bundle any number of allocations into one and free them all at once rather than manage -each allocation independently. Special-purpose allocators can be used to improve performance -or memory usage for any particular application's needs. - -[1]: Actually there is a string concatenation operator (generally an array concatenation operator), but it only works at compile time, so it still doesn't do any runtime heap allocation. - -# First-class support for no standard library - -As hinted above, Zig has an entirely optional standard library. Each std lib API only gets compiled -into your program if you use it. Zig has equal support for either linking against libc or -not linking against it. Zig is friendly to bare-metal and high-performance development. - -It's the best of both worlds; for example in Zig, WebAssembly programs can both use -the normal features of the standard library, and still result in the tiniest binaries when -compared to other programming languages that support compiling to WebAssembly. - -# A Portable Language for Libraries - -One of the holy grails of programming is code reuse. Sadly, in practice, we find ourselves re-inventing the wheel many times over again. Often it's justified. - - * If an application has real-time requirements, then any library that uses garbage collection or any other non-deterministic behavior is disqualified as a dependency. - * If a language makes it too easy to ignore errors, and thus hard to verify that a library correctly handles and bubbles up errors, it can be tempting to ignore the library and re-implement it, knowing that one handled all the relevant errors correctly. Zig is designed such that the laziest thing a programmer can do is handle errors correctly, and thus one can be reasonably confident that a library will properly bubble errors up. - * Currently it is pragmatically true that C is the most versatile and portable language. Any language that does not have the ability to interact with C code risks obscurity. Zig is attempting to become the new portable language for libraries by simultaneously making it straightforward to conform to the C ABI for external functions, and introducing safety and language design that prevents common bugs within the implementations. - -# A Package Manager and Build System for Existing Projects - -Zig is a toolchain in addition to a programming language. It comes with a -[build system and package manager](/learn/build-system/) that are useful even -in the context of a traditional C/C++ project. - -Not only can you write Zig code instead of C or C++ code, but you can use Zig -as a replacement for autotools, cmake, make, scons, ninja, etc. And on top of -this, it provides a package manager for native dependencies. This build system -is appropriate even if the entirety of a project's codebase is in C or C++. -For example, by -[porting ffmpeg to the zig build system](https://github.com/andrewrk/ffmpeg), -it becomes possible to compile ffmpeg on any supported system for any supported -system using only a [50 MiB download of zig](/download/). For open source -projects, this streamlined ability to build from source - and even -cross-compile - can be the difference between gaining or losing valuable -contributors. - -System package managers such as apt-get, pacman, homebrew, and others are -instrumental for end user experience, but they can be insufficient for the -needs of developers. A language-specific package manager can be the difference -between having no contributors and having many. For open source projects, the -difficulty of getting the project to build at all is a huge hurdle for -potential contributors. For C/C++ projects, having dependencies can be fatal, -especially on Windows, where there is no package manager. Even when just -building Zig itself, most potential contributors have a difficult time with the -LLVM dependency. Zig offers a way for projects to depend on native libraries -directly - without depending on the users' system package manager to have the -correct version available, and in a way that is practically guaranteed to -successfully build projects on the first try regardless of what system is being -used and independent of what platform is being targeted. - -**Other languages have package managers but they do not eliminate pesky system -dependencies like Zig does.** - -Zig can replace a project's build system with a reasonable language using -a declarative API for building projects, that also provides package management, -and thus the ability to actually depend on other C libraries. The ability to -have dependencies enables higher level abstractions, and thus the proliferation -of reusable high-level code. - -# Simplicity - -C++, Rust, and D have such a large number of features that they can be distracting from the actual meaning of the application you are working on. One finds oneself debugging one's knowledge of the programming language instead of debugging the application itself. - -Zig has no macros yet is still powerful enough to express complex programs in a -clear, non-repetitive way. Even Rust has macros with special cases like -`format!`, which is implemented in the compiler itself. Meanwhile in Zig, the -equivalent function is implemented in the standard library with no special case -code in the compiler. - -# Tooling - -Zig can be downloaded from [the downloads section](/download/). Zig provides -binary archives for Linux, Windows, and macOS. The following describes what you -get with one of these archives: - -* installed by downloading and extracting a single archive, no system configuration needed -* statically compiled so there are no runtime dependencies -* supports using LLVM for optimized release builds while using Zig's custom backends for faster compilation performance -* additionally supports a backend for outputting C code -* out of the box cross-compilation to most major platforms -* ships with source code for libc that will be dynamically compiled when needed for any supported platform -* includes build system with concurrency and caching -* compiles C and C++ code with libc support -* drop-in GCC/Clang command line compatibility with `zig cc` -* Windows resource compiler +Exemples de flux de control ocult: + +* D té funcions `@property`, que són mètodes que es criden amb el que sembla un accés a un camp, de manera que a l'exemple anterior, `c.d` podria cridar una funció. +* C++, D i Rust tenen sobrecàrrega d'operadors, de manera que l'operador `+` podria cridar una funció. +* C++, D i Go tenen excepcions throw/catch (de vegades també anomenades panic/recover), de manera que `foo()` podria llançar una excepció i evitar que es cridi `bar()`. (Per descomptat, fins i tot a Zig `foo()` podria bloquejar-se i evitar que es cridi `bar()`, però això pot passar en qualsevol llenguatge Turing-complet). + +El propòsit d'aquesta decisió de disseny és millorar la llegibilitat. + +# Sense assignacions ocultes + +Zig té un enfocament de no intervenció pel que fa a l'assignació de memòria dinàmica +(heap). No hi ha cap paraula clau `new` ni cap altra característica del llenguatge que utilitzi +un assignador de memòria dinàmica (per exemple, l'operador de concatenació de cadenes[1]). Tot +el concepte de memòria dinàmica és gestionat pel codi de la biblioteca i de l'aplicació, +no pel llenguatge. + +Exemples d'assignacions de memòria ocultes: + +* El `defer` de Go assigna memòria a una pila local de funció. A més de ser una manera poc intuïtiva + perquè funcioni aquest flux de control, pot causar fallades de memòria insuficient si utilitzeu + `defer` dins d'un bucle. +* Les corrutines de C++ assignen memòria dinàmica per cridar una corrutina. +* A Go, una crida a funció pot causar assignació de memòria dinàmica perquè les goroutines assignen piles petites + que es redimensionen quan la pila de crides es fa prou profunda. +* Les API principals de la biblioteca estàndard de Rust entren en pànic en condicions de memòria insuficient, i les API alternatives + que accepten paràmetres d'assignador de memòria són una idea d'últim moment + (vegeu [rust-lang/rust#29802](https://github.com/rust-lang/rust/issues/29802)). + +Gairebé tots els llenguatges amb recollida de memòria brossa tenen assignacions ocultes +escampades, ja que el recollidor de memòria brossa amaga l'evidència en la part de neteja. + +El problema principal amb les assignacions ocultes és que impedeixen la *reutilització* +d'un tros de codi, limitant innecessàriament el nombre d'entorns als quals aquest codi seria +apropiat per desplegar-se. En poques paraules, hi ha casos d'ús on cal poder confiar que el +flux de control i les crides a funcions no tinguin l'efecte secundari de l'assignació de +memòria, per tant, un llenguatge de programació només pot servir aquests casos d'ús si +pot proporcionar de manera realista aquesta garantia. + +A Zig, hi ha característiques de la biblioteca estàndard que proporcionen i treballen amb +assignadors de memòria dinàmica, però aquestes són característiques opcionals de la +biblioteca estàndard, no integrades al llenguatge en si. +Si mai inicialitzeu un assignador de memòria dinàmica, podeu estar segurs que el vostre +programa no farà assignacions de memòria dinàmica. + +Tota característica de la biblioteca estàndard que necessita assignar memòria dinàmica +accepta un paràmetre `Allocator` per fer-ho. Això significa que la biblioteca estàndard de +Zig admet objectius autònoms (freestanding). Per exemple, `std.ArrayList` i `std.AutoHashMap` +es poden utilitzar per a la programació en maquinari nu! + +Els assignadors de memòria personalitzats fan que la gestió manual de la memòria sigui +molt fàcil. Zig té un assignador de memòria de depuració que manté la seguretat de la +memòria davant de l'ús després de l'alliberament (use-after-free) i el doble alliberament +(double-free). Detecta automàticament i imprimeix traces de pila (stack traces) de fuites de +memòria (memory leaks). Hi ha un assignador de memòria d'arena perquè pugueu agrupar qualsevol +nombre d'assignacions en una de sola i alliberar-les totes alhora en lloc de gestionar cada +assignació de manera independent. Es poden utilitzar assignadors de memòria de propòsit +especial per millorar el rendiment o l'ús de memòria per a les necessitats de qualsevol +aplicació particular. + +[1]: De fet, hi ha un operador de concatenació de cadenes (generalment un operador de concatenació de matrius), però només funciona en temps de compilació, de manera que encara no fa cap assignació de memòria dinàmica en temps d'execució. + +# Suport de primera classe per a no tenir biblioteca estàndard + +Com s'ha insinuat anteriorment, Zig té una biblioteca estàndard totalment opcional. Cada +API de la biblioteca estàndard només es compila al vostre programa si l'utilitzeu. Zig té +el mateix suport tant per enllaçar amb libc com per no enllaçar-hi. Zig és amigable amb el +desenvolupament bare-metal i d'alt rendiment. + +És el millor dels dos móns; per exemple, a Zig, els programes WebAssembly poden utilitzar les +característiques normals de la biblioteca estàndard i, tot i així, donar lloc als binaris +més petits en comparació amb altres llenguatges de programació que admeten la compilació +a WebAssembly. + +# Un llenguatge portable per a biblioteques + +Un dels sants graals de la programació és la reutilització de codi. Malauradament, a la pràctica, ens trobem reinventant la roda moltes vegades. Sovint està justificat. + + * Si una aplicació té requisits de temps real, aleshores qualsevol biblioteca que utilitzi recollida de memòria brossa o qualsevol altre comportament no determinista queda desqualificada com a dependència. + * Si un llenguatge fa que sigui massa fàcil ignorar els errors, i per tant difícil de verificar que una biblioteca gestiona i propaga els errors correctament, pot ser temptador ignorar la biblioteca i reimplementar-la, sabent que un ha gestionat tots els errors rellevants correctament. Zig està dissenyat de manera que la cosa més mandrosa que un programador pot fer és gestionar els errors correctament, i per tant un pot estar raonablement segur que una biblioteca propagarà els errors correctament. + * Actualment és pragmàticament cert que C és el llenguatge més versàtil i portable. Qualsevol llenguatge que no tingui la capacitat d'interactuar amb codi C corre el risc de caure en l'obscuritat. Zig està intentant convertir-se en el nou llenguatge portable per a biblioteques fent que sigui senzill complir amb l'ABI de C per a funcions externes, i introduint seguretat i disseny de llenguatge que prevenen errors comuns dins de les implementacions. + +# Un gestor de paquets i sistema de compilació per a projectes existents + +Zig és una cadena d'eines a més d'un llenguatge de programació. Ve amb un +[sistema de comilació i gestor de paquets](/learn/build-system/) que són útils fins i tot +en el context d'un projecte tradicional de C/C++. + +No només podeu escriure codi Zig en lloc de codi C o C++, sinó que podeu utilitzar Zig com +a reemplaçament d'autotools, cmake, make, scons, ninja, etc. I a més d'això, proporciona +un gestor de paquets per a dependències natives. Aquest sistema de compilació és apropiat +fins i tot si la totalitat del codi base d'un projecte és en C o C++. Per exemple, +[portant ffmpeg al sistema de compilació de zig](https://github.com/andrewrk/ffmpeg), +es fa possible compilar ffmpeg en qualsevol sistema compatible per a qualsevol sistema compatible +utilitzant només una [descàrrega de 50 MiB de zig](/download/). Per als projectes de codi +obert, aquesta capacitat simplificada de construir des de la font - i fins i tot compilar de +manera creuada - pot ser la diferència entre guanyar o perdre col·laboradors valuosos. + +Els gestors de paquets del sistema com apt-get, pacman, homebrew i altres són fonamentals per +a l'experiència de l'usuari final, però poden ser insuficients per a les necessitats dels +desenvolupadors. Un gestor de paquets específic del llenguatge pot ser la diferència entre +no tenir col·laboradors i tenir-ne molts. Per als projectes de codi obert, la dificultat +d'aconseguir que el projecte es compili és un gran obstacle per als col·laboradors +potencials. Per als projectes C/C++, tenir dependències pot ser fatal, especialment a Windows, +on no hi ha gestor de paquets. Fins i tot quan es construeix el propi Zig, la majoria dels +col·laboradors potencials tenen dificultats amb la dependència de LLVM. Zig ofereix una manera +perquè els projectes depenguin de biblioteques natives directament - sense dependre del gestor +de paquets del sistema dels usuaris per tenir la versió correcta disponible, i d'una manera que +està pràcticament garantida per construir projectes amb èxit al primer intent independentment +del sistema que s'utilitzi i independentment de la plataforma a la qual es dirigeixi. + +**Altres llenguatges tenen gestors de paquets però no eliminen les molestes dependències del +sistema com ho fa Zig.** + +Zig pot substituir el sistema de construcció d'un projecte amb un llenguatge raonable +utilitzant una API declarativa per construir projectes, que també proporciona gestió de +paquets, i per tant la capacitat de dependre realment d'altres biblioteques C. La capacitat +de tenir dependències permet abstraccions de nivell superior, i per tant la proliferació de +codi d'alt nivell reutilitzable. + +# Simplicitat + +C++, Rust i D tenen un nombre tan gran de característiques que poden distreure del significat real de l'aplicació en què esteu treballant. Un es troba depurant el seu coneixement del llenguatge de programació en lloc de depurar l'aplicació en si. + +Zig no té macros però encara és prou potent per expressar programes complexos d'una +manera clara i no repetitiva. Fins i tot Rust té macros amb casos especials com `format!`, +que s'implementa al propi compilador. Mentrestant, a Zig, la funció equivalent s'implementa +a la biblioteca estàndard sense cap codi de cas especial al compilador. + +# Eines + +Zig es pot descarregar des de la [secció de descàrregues](/download/). Zig proporciona fitxers +d'arxiu binaris per a Linux, Windows i macOS. A continuació es descriu el que obteniu amb un +d'aquests arxius: + +* instal·lat descarregant i extraient un sol arxiu, no cal configuració del sistema +* compilat estàticament perquè no hi hagi dependències en temps d'execució +* admet l'ús de LLVM per a compilacions de llançament optimitzades mentre utilitza els backends personalitzats de Zig per a un rendiment de compilació més ràpid +* admet addicionalment un backend per generar codi C +* compilació creuada immediata a la majoria de plataformes principals +* s'envia amb el codi font per a libc que es compilarà dinàmicament quan sigui necessari per a qualsevol plataforma compatible +* inclou sistema de construcció amb concurrència i memòria cau +* compila codi C i C++ amb suport libc +* compatibilitat de línia d'ordres GCC/Clang directa amb `zig cc` +* compilador de recursos de Windows diff --git a/content/ca-ES/zsf.smd b/content/ca-ES/zsf.smd index 8316e143a..e04b6c257 100644 --- a/content/ca-ES/zsf.smd +++ b/content/ca-ES/zsf.smd @@ -7,9 +7,9 @@ "mobile_menu_title": "ZSF", }, --- -# Sponsoring the Zig Software Foundation +# Patrocinament la Zig Software Foundation -Please consider a recurring donation. It takes ongoing labor to maintain and support high-quality software! +Considereu una donació recurrent. Cal un esforç continuat per mantenir i donar suport a programari d'alta qualitat! ```=html
@@ -40,47 +40,45 @@ Please consider a recurring donation. It takes ongoing labor to maintain and sup ``` -# Mission statement -The mission of the Zig Software Foundation is to promote, protect, and advance the Zig programming language, to support and facilitate the growth of a diverse and international community of Zig programmers, and to provide education and guidance to students, teaching the next generation of programmers to be competent, ethical, and to hold each other to high standards. +# Declaració de la missió +La missió de la Zig Software Foundation és promoure, protegir i fer avançar el llenguatge de programació Zig, donar suport i facilitar el creixement d'una comunitat diversa i internacional de programadors Zig, i proporcionar educació i orientació als estudiants, ensenyant a la propera generació de programadors a ser competents, ètics i a exigir-se alts estàndards. -**ZSF is a 501(c)(3) non-profit corporation.** Finances, meeting minutes, and other details are [available to the public](https://drive.google.com/drive/folders/1ucHARxVbhrBbuZDbhrGHYDTsYAs8_bMH?usp=sharing). +**La ZSF és una corporació sense ànim de lucre 501(c)(3).** Les finances, les actes de les reunions i altres detalls estan [disponibles al públic](https://drive.google.com/drive/folders/1ucHARxVbhrBbuZDbhrGHYDTsYAs8_bMH?usp=sharing). -# Board members +# Membres de la junta - [Andrew Kelley](https://andrewkelley.me/) (President) -- [Josh Wolfe](https://github.com/thejoshwolfe/) (Secretary) -- [Mason Remaley](https://www.masonremaley.com/) (Treasurer) +- [Josh Wolfe](https://github.com/thejoshwolfe/) (Secretari) +- [Mason Remaley](https://www.masonremaley.com/) (Tresorer) -# Sponsorship +# Patrocini -By donating to ZSF, you are funding development of the Zig Programming Language and its ecosystem, which in turn benefits the greater open source community. Zig community members have landed bug fixes in [LLVM](https://llvm.org/), [Wine](https://winehq.org/), [QEMU](https://qemu.org/), [musl libc](https://musl.libc.org/), [GDB](https://www.gnu.org/software/gdb/) and others. +En donar a la ZSF, esteu finançant el desenvolupament del llenguatge de programació Zig i el seu ecosistema, cosa que al seu torn beneficia la comunitat de codi obert en general. Els membres de la comunitat Zig han solucionat errors a [LLVM](https://llvm.org/), [Wine](https://winehq.org/), [QEMU](https://qemu.org/), [musl libc](https://musl.libc.org/), [GDB](https://www.gnu.org/software/gdb/) i altres. -ZSF is a small organization and makes efficient use of monetary resources. The plan is to keep it that way, but we do want to turn our unpaid volunteers into paid maintainers to help merge pull requests and make swifter progress towards 1.0. The whole point of ZSF being non-profit is to benefit people. We're trying to get open source maintainers paid for their time. +La ZSF és una organització petita i fa un ús eficient dels recursos monetaris. El pla és mantenir-ho així, però sí que volem convertir els nostres voluntaris no remunerats en mantenidors remunerats per ajudar a fer *merge* de les *pull requests* i avançar més ràpidament cap a la versió 1.0. L'objectiu principal que la ZSF sigui sense ànim de lucre és beneficiar les persones. Estem intentant que els mantenidors de codi obert cobrin pel seu temps. -# Donation information -Here's useful information to donate through means other than GitHub Sponsors. -Make sure to check your local law to see if you can deduct donations from your taxes. +# Informació de la donació +Aquí teniu informació útil per donar a través de mitjans diferents de GitHub Sponsors. Assegureu-vos de revisar la vostra legislació local per veure si podeu deduir les donacions dels vostres impostos. ## EIN 84-5105214 -## Address +## Adreça Zig Software Foundation 1632 1st Ave #21385 New York, NY 10028 -## Additional donation methods supported +## Mètodes de donació addicionals compatibles - [Every](https://www.every.org/zig-software-foundation-inc/) - [GitHub Sponsors](https://github.com/sponsors/ziglang) -- [Benevity](https://benevity.com) (recommended if your employer matches donations!) -- Bank transfers (including from outside of the US, contact us for more info) -- Physical checks (see the snail mail address listed above) +- [Benevity](https://benevity.com) (recomanat si el vostre ocupador iguala les donacions!) +- Transferències bancàries (incloent-hi des de fora dels EUA, contacteu-nos per a més informació) +- Xecs físics (vegeu l'adreça postal indicada anteriorment) - [Wise](https://wise.com) -**Please don't hesitate to contact us at donations@ziglang.org if you have questions or specific needs.** +**No dubteu a contactar amb nosaltres a donations@ziglang.org si teniu preguntes o necessitats específiques.** -# Corporate sponsors +# Patrocinadors corporatius -## Monetary donations -The following companies are providing direct financial support to the Zig Software foundation by donating more than $1000/mo. +Les següents empreses proporcionen suport financer directe a la Zig Software Foundation donant més de 1000 $/mes. []($code.language('=html').siteAsset('corporate-sponsors.html')) From cf07fdd622a53b55838ae47a1b1f3784aaefa228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Wed, 26 Nov 2025 21:44:48 +0900 Subject: [PATCH 4/8] i18n: translate code of conduct and community to Catalan --- content/ca-ES/code-of-conduct.smd | 94 ++++++++++++ content/ca-ES/community.smd | 246 ++++++++++++++++++++++++++++++ content/ca-ES/index.smd | 2 +- 3 files changed, 341 insertions(+), 1 deletion(-) create mode 100644 content/ca-ES/code-of-conduct.smd create mode 100644 content/ca-ES/community.smd diff --git a/content/ca-ES/code-of-conduct.smd b/content/ca-ES/code-of-conduct.smd new file mode 100644 index 000000000..8cf6e2d3a --- /dev/null +++ b/content/ca-ES/code-of-conduct.smd @@ -0,0 +1,94 @@ +--- +.title = "Codi de Conducta", +.author = "", +.date = @date("2025-11-22:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Codi de Conducta", +}, +--- + +La comunitat Zig és descentralitzada. Qualsevol persona és lliure de crear i mantenir la +seva pròpia [comunitat](/community), la qual no està subjecta a aquestes regles. + +**Aquest document conté les regles que governen només aquests espais:** + +* L'organització ziglang a GitHub +* El canal de l'IRC #zig a Libera.chat +* El xat de Zulip per al desenvolupament del projecte Zig + +Les regles aquí són estrictes. Aquest espai és per a treball tècnic enfocat i relacionat +exclusivament amb el projecte Zig. És responsabilitat de tothom mantenir un ambient positiu, +especialment quan sorgeixen desacords. + +# Política Estricta de No-IA / No-LLM + +No es permeten LLMs per a les incidències. **No utilitzeu GitHub Copilot per a escriure incidències.** + +No es permeten LLMs per a les pull requests. + +No es permeten LLMs per als comentaris en el seguiment d'errors, incloent-hi la traducció. Es +recomana l'anglès, però no és obligatori. Us convidem a publicar en la vostra llengua materna +i confiar que altres faran servir les seves pròpies eines de traducció per interpretar les +vostres paraules. + +# Si us plau, no presenteu una proposta per a canviar el llenguatge + +Gràcies pel vostre interès a millorar el llenguatge Zig. No obstant això, no estem acceptant +noves propostes per a canviar el llenguatge. + +Si voleu fer una proposta de canvi en el llenguatge, heu de convèncer un membre de l'equip +principal de Zig perquè la presenti en nom vostre i la defensi. Alguns són contractistes +remunerats i altres són voluntaris, i tots trien lliurement com dediquen el seu temps. Un +membre de l'equip principal pot estar disposat a defensar propostes, o potser no, a la seva +discreció. Si us plau, no assetgeu els membres de l'equip principal de Zig. + +# Només Comportament Segur i Constructiu + +Exemples de comportament que contribueixen a crear un ambient positiu inclouen: + + * Utilitzar un llenguatge acollidor i inclusiu. + * Ser respectuós amb els diferents punts de vista i experiències. + * Acceptar amb elegància la crítica constructiva. + * Ajudar una altra persona a assolir els seus propis objectius. + * Mostrar empatia envers els altres. + * Mostrar agraïment per la feina dels altres. + * Validar l'experiència, les habilitats, la visió i els casos d'ús d'una altra persona. + +Exemples de comportament inacceptable per part dels participants inclouen: + + * Atenció o insinuacions sexuals no desitjades, o l'ús de llenguatge o imatges sexualitzades que causin incomoditat. + * Trolling, comentaris insultants/despectius i atacs personals. Qualsevol cosa antagònica envers algú altre. + * Discussió fora de tema de qualsevol mena, especialment sobre qüestions ofensives o sensibles. + * Publicar informació privada d'altres persones, com ara una adreça física o electrònica, sense permís explícit. + * Discutir aquest Codi de Conducta o acusar públicament algú de violar-lo. + * Fer que algú altre se senti com un foraster o insinuar una manca d'habilitats tècniques. + * Comportament destructiu. Qualsevol cosa que perjudiqui Zig o un altre projecte de codi obert. + +# Aplicació + +Si necessiteu informar d'un problema, podeu contactar amb Andrew Kelley o Loris Cro, que són +empleats de la Zig Software Foundation, i per tant la moderació d'aquest espai forma part de +la nostra feina. Eliminarem ràpidament qualsevol persona que estigui antagonitzant els altres +o sent generalment destructiva. + +Això inclou l'assetjament privat. Si la persona A és assetjada o antagonitzada directament +per la persona B, es bloquejarà la participació de la persona B en aquest espai, encara que +l'assetjament no hagi tingut lloc en un dels mitjans directament sota la regla d'aquest Codi +de Conducta. + +Com s'ha indicat, la discussió d'aquest Codi de Conducta no hauria de tenir lloc a GitHub +o a l'IRC perquè aquests espais són per a treballar directament en el codi, no per a la +metadiscussió. Si teniu cap problema amb això, podeu contactar-me directament, o podeu +unir-vos a un dels espais de la comunitat que tenen regles diferents. + + * Andrew Kelley + * Loris Cro + +# Conclusió + +Gràcies per llegir les regles. Junts, podem fer d'aquest espai un lloc acollidor i inclusiu +per a tothom, independentment de l'edat, la mida corporal, la discapacitat, l'ètnia, les +característiques sexuals, la identitat i expressió de gènere, el nivell d'experiència, +l'educació, l'estatus socioeconòmic, la nacionalitat, l'aparença personal, la raça, la +religió o la identitat i orientació sexual. diff --git a/content/ca-ES/community.smd b/content/ca-ES/community.smd new file mode 100644 index 000000000..f80db20d8 --- /dev/null +++ b/content/ca-ES/community.smd @@ -0,0 +1,246 @@ +--- +.title = "Comunitat", +.author = "", +.date = @date("2025-11-22:00:00:00"), +.layout = "page.shtml", +.custom = { + "mobile_menu_title": "Comunitat", +}, +--- + +La comunitat Zig és descentralitzada. Tothom és lliure de començar i mantenir el seu +propi espai per reunir la comunitat i enviar una sol·licitud d'incorporació (pull request) +per editar aquesta pàgina i afegir-hi un enllaç. + +No hi ha concepte d'"oficial" o "no oficial"; tanmateix, cada lloc de reunió té els seus +propis moderadors i normes. + +Quan afegiu una nova comunitat, afegiu-la al final de la llista existent com a forma de cortesia. + +Consulteu la secció Desenvolupament del compilador (al final d'aquesta pàgina) per a +les comunitats dedicades a la col·laboració en el desenvolupament del compilador Zig. + +A causa de limitacions de temps, l'equip principal de Zig es reserva el dret de curar +arbitràriament aquesta pàgina basant-se en opinions opaques i subjectives, així com de +descuidar la cura d'aquesta pàgina durant llargs períodes de temps. + +# Discussió general +## IRC + * `#zig` a irc.libera.chat + - Moderadors: + - [Andrew Kelley](https://andrewkelley.me/) + - [Isaac Freund](https://isaacfreund.com/) + - [Codi de conducta](/code-of-conduct) + +## Discord (Anglès) + * [Zig Programming Language Discord](https://discord.gg/zig) + - Moderadors: [Felix Queißner](https://github.com/MasterQ32), [InKryption](https://github.com/InKryption), [Loris Cro](https://github.com/kristoff-it), [Agni](https://github.com/sin-ack), [Lee Cannon](https://github.com/leecannon), [Robin Voetter](https://github.com/Snektron), [Matt Knight](https://github.com/mattnite) + - Normes: + - Vegeu #info en unir-vos + - Seguiu les [directrius de la comunitat de Discord](https://discord.com/guidelines) + * [Zig Embedded Group](https://discord.gg/bbVRwX4KEf) + - Moderadors: [mattnite](https://github.com/mattnite), [MasterQ32](https://github.com/MasterQ32) + - Normes: + - Sigueu amables i respectuosos, + - Seguiu les [directrius de la comunitat de Discord](https://discord.com/guidelines) + * [cod1r's Zig discord](https://discord.gg/yEBzfgHrNF) + - Moderadors: [cod1r](https://github.com/cod1r), [haze](https://github.com/haze) + - Normes: + - Sigueu amables i respectuosos + - Seguiu les [directrius de la comunitat de Discord](https://discord.com/guidelines) + + +## Discord (Internacional) + * [Zig-JP(Japonès)](https://discord.gg/brNYwrtncu) + - Moderadors: [aiotter](https://github.com/aiotter) + - Normes: segueix les normes del [Discord del llenguatge de programació Zig](https://discord.gg/gxsFFjE) + + * [Zig-KR(Coreà)](https://discord.ziglang.kr) + - Moderadors: [Pribess](https://github.com/Pribess) + - Normes: segueix les normes del [Discord del llenguatge de programació Zig](https://discord.gg/gxsFFjE) + + * [Zig-AR(Àrab)](https://discord.com/invite/BguRbZrP) + - Moderadors: [Hasan Yousef](https://github.com/hajsf) + - Normes: segueix les normes del [Discord del llenguatge de programació Zig](https://discord.gg/gxsFFjE) + +* [Zig-CN(Xinès)](https://discord.ziglang.org.cn) + - Moderadors: [liuchong](https://github.com/liuchong) + - Normes: segueix les normes del [Discord del llenguatge de programació Zig](https://discord.gg/gxsFFjE) + +* [Zig-DE(Alemany)](https://discord.gg/G8HgRJaqbB) + - Moderadors: [Shadowdara](https://github.com/shadowdara) + - Normes: segueix les normes del [Discord del llenguatge de programació Zig](https://discord.gg/gxsFFjE) + +## Tencent QQ + + * [Expert Zig(Xinès)](https://qm.qq.com/cgi-bin/qm/qr?k=Grsz9EpZRobM3P_K9Ch5e59N6xXQFYUB&authKey=DBD1qC54GFzwHo1B5aK/Ola6sgoQdxHBZWc5gHfhZ0LU6nEf/0d6cr6rnTpaOSrt&noverify=0): 930564004 + +## Telegram + + * [Zig Telegram (Espanyol)](https://t.me/+TuqWR0w6W5o1MDAx) + - Propietari: [Samuel Bonilla](https://github.com/SamuelBonilla) + * [Zig 中文社区 (Xinès)](https://t.me/ZigChinese) + - Propietari: [LemonHX](https://github.com/lemonhx) + * [Zig Telegram (Parla russa)](https://t.me/ziglang_ru) + - Administrador: [BratishkaErik](https://github.com/BratishkaErik) + * [Zig Telegram (Portuguès)](https://t.me/ziglang_br) + - Propietari: [Matheus C. França](https://github.com/kassane) + * [Zig Telegram (Persa)](https://t.me/zig_fa) + - Propietari: [Mahdi Sharifi](https://github.com/devraymondsh) + * [Zig Telegram (Uzbek)](https://t.me/ziglang_uz) + - Propietari: [yuri](https://github.com/katsuki-yuri) + * [Zig Telegram (Àrab)](https://t.me/zig_Arabic) + - Propietari: [Hasan Yousef](https://github.com/hajsf) + * [Zig Telegram (Italià)](https://t.me/ziglang_it) + - Propietari: [kristoff](https://github.com/kristoff-it) + * [Zig India](https://t.me/zigindia) + - Propietari: [Tushar Sadhwani](https://t.me/tushar_lol) + * [Zig Lang Stickers](https://t.me/addstickers/Ziglang) + * [Zig Language Indonesia (Indonesi)](https://t.me/zigindonesia) + - Propietari: [Hadi Hidayat (Robi) Hammurabi](https://t.me/hadihammurabi) + * [Zig Telegram (Hebreu)](https://t.me/ziglang_il) + - Propietari: [Tal Z](https://github.com/tal2) + +## Matrix / Element + + * [#zig:tchncs.de](https://matrix.to/#/#zig:tchncs.de) + - Moderadors: [Josias](https://github.com/justjosias), [Simon A. Nielsen Knights](https://github.com/tauoverpi) + - Normes: Igual que a l'IRC + * [#bayareazig:matrix.org](https://matrix.to/#/#bayareazig:matrix.org) + - Moderadors: [Salar Rahmanian](https://github.com/softinio) + - Normes: Igual que a l'IRC + +## Zulip + + * [zig-lang](https://zig-lang.zulipchat.com/join/fbhff4nwoyop6j5fpbu3yqfx/) + - Administrador: Aria Elfren (usuari de Zulip) + - Normes: Igual que a l'IRC (per ara) + + +## Stoat + + * [Zig Programming Language](https://old.stoat.chat/invite/zM0bnVNJ) + - Moderadors: [Ali Cheraghi](https://github.com/alichraghi) + +## Slack + * [ziglang.slack.com](https://join.slack.com/t/ziglang/shared_invite/zt-2t5c84dtz-VLkkveTO_tcejLnliesHmg) + - Moderador: [Loong](mailto:longxianwen@outlook.com) + - Normes: Igual que a l'IRC + * [Zig programming language](https://join.slack.com/t/zigprogramming/shared_invite/zt-1zqm0mmu9-66~IkF3Bnw5HjVOOEhWIag) + - Moderador: [Annie Herrmann](mailto:mail@anniiii.xyz) + - Normes: Igual que a l'IRC + +## WhatsApp + * [Zig Nigeria](https://chat.whatsapp.com/Cv6PA8uBoEB9BoxnDOpKQI) + - Moderador: [Ayodeji Adeoti](mailto:adeoti.15.jude@gmail.com) + - Normes: Igual que a l'IRC + * [Zig lang Israel](https://chat.whatsapp.com/El49FFSVtPfCZoRmd4Ag4q) + - Normes: + * Sigueu amables. + * Mantingueu-vos en el tema. + +## Llista de correu + +* [zig-brasil@googlegroups.com](https://groups.google.com/g/zig-brasil) + - Moderador: [Matheus C. França](https://github.com/kassane) + - Normes: Igual que a l'IRC + +## Fòrums + +* [Ziggit](https://ziggit.dev) + - Moderadors: + - [@jecolon](https://github.com/jecolon) + - [Zach Raineri](https://github.com/zraineri) + - [@andrewCodeDev](https://github.com/andrewCodeDev) + - [Termes del servei](https://ziggit.dev/tos) + - [Preguntes freqüents](https://ziggit.dev/faq) + +* [Zig 中文社区论坛](https://github.com/zigcc/forum/discussions) + +* [ZigQuestions](https://github.com/nektro/zigquestions) + +## Merxandatge + + * [Teespring Store run by @wilsonk](https://teespring.com/stores/wilsons-store-12) + - La botiga inclou nous dissenys de Logos, Zero, Ziggy i Zigfast + - Dissenys ANTICS (https://teespring.com/stores/wilsons-store-5) + - Els beneficis donen suport a Zig (@andrewrk: Ho confirmo) + +## MAX + * [Zig (Rus)](https://max.ru/join/22ertAE9dW5hIelAlVta988HPkLHYJrodNV_KXif0uk) + - Propietari: [Nickolay Chistov](https://github.com/nchistov) + +## X (abans Twitter) + * [Zig Programming Language](https://x.com/i/communities/1830711127354851778) + - Moderador: [gdjohn4s](https://x.com/jontec8) + - Normes: Les podeu trobar al perfil de la comunitat + +## Reddit + +(Aquesta secció ha estat escrita per Andrew Kelley) + +Solia moderar el subreddit /r/zig. Durant les protestes de Reddit el juny de 2023, vaig decidir +tancar permanentment /r/zig, fent-lo privat i animant els usuaris a anar a ziggit.dev en el +seu lloc. + +Un trol va enviar un missatge als administradors de Reddit i va aconseguir accés de moderador +a /r/zig, va reobrir el subreddit i va començar a fer vandalisme juvenil durant unes setmanes, +abans de decidir que ja s'havien divertit prou i abandonar el lloc. + +Després, [Jens Goldberg](https://github.com/Aransentin) va enviar un missatge als administradors +de Reddit i va aconseguir convertir-se en moderador de /r/zig. És força passiu, no modera +gaire i deixa que el sistema de votació de Reddit gestioni els desacords. + +Mentre el subreddit era privat, la gran majoria de persones valuoses es van traslladar a altres +comunitats. La majoria de la gent que va quedar era xurma, disposada a tolerar el troleig i +més interessada en Reddit com a plataforma que en Zig com a projecte. + +Ara, el subreddit de Zig és un erm complet, i personalment aconsello no anar-hi. De fet, +he eliminat tot el meu compte de Reddit. + +No tinc temps ni energia per avaluar la majoria de comunitats Zig, així que no puc ni +aprovar-les ni desaprovar-les; tanmateix, el subreddit de Zig és una excepció. + +És un lloc horrible i em reafirmo en la meva decisió de tancar-lo permanentment. No estic +content que es reobrís contra la meva voluntat. + +# Transmissions + +## SHOWTIME + +El programa on els membres de la comunitat Zig comparteixen codi i idees. + +https://zig.show/ + + * [YouTube](https://www.youtube.com/channel/UC2EQzAewrC10KCDFSS4j-zA) + * [Butlletí](https://zig.show/newsletter) + * [Sol·licitud per parlar](https://zig.show/speak) + * [Discord](https://discord.gg/B73sGxF) + El servidor de Discord Zig SHOWTIME serveix com a eina de coordinació per organitzar el programa, i com a lloc on les persones interessades en l'èxit de Zig poden socialitzar i col·laborar en nous projectes. L'objectiu principal d'aquest espai és crear una comunitat de creadors (ja sigui codi, blogs, vídeos o indefinits), perquè tots puguem treure el màxim profit de la nostra experiència Zig. Ningú neix sabent Zig, així que tothom és benvingut a divertir-se en aquest servidor; però, si no esteu segurs de si Zig és el llenguatge adequat per a vosaltres, es recomana que consulteu primer altres comunitats Zig, ja que podrien estar més enfocades a ajudar els nouvinguts al llenguatge. + +## Individus + + * [Andrew Kelley](https://www.twitch.tv/andrewrok) - Desenvolupament del projecte Zig + * [Loris Cro](https://www.twitch.tv/kristoff_it) - Coses de Showtime, coses d'event-loop, miscel·lània + * [Benjamin Feng](https://www.twitch.tv/fengb) - Emuladors de GameBoy, web assembly, assignadors + * [Meghan Denny](https://www.twitch.tv/nektro77) - Gestor de paquets Zigmod, servidors web i més + * [KomariSpaghetti](https://www.twitch.tv/komarispaghetti) + * [daurnimator](https://www.twitch.tv/daurnimator) + * [Dan B](https://www.twitch.tv/danbokser) - SO personalitzat en Zig i aplicacions per a ell + * [Spex_Guy](https://www.twitch.tv/spex_guy) + * [Dr_Deano](https://www.twitch.tv/dr_deano) - Nucli personalitzat en Zig + * [Isaac Freund](https://www.twitch.tv/ifreund_) - River, un compositor Wayland en Zig + * [Auguste Rame](https://www.twitch.tv/SuperAuguste) - Coses de Zig + Java (JNI, impl JVM en Zig), projectes aleatoris en Zig, creació de mems Zig i més - [Vídeos arxivats](https://www.youtube.com/channel/UC8JUunJCTUo0icqJzUfbT2A), [Vídeo recomanat](https://www.youtube.com/watch?v=6Zw6llGGRwA) + * [sphaerophoria](https://www.twitch.tv/sphaerophoria) - Diversos projectes en Zig i Rust - [Vídeos arxivats](https://www.youtube.com/@sphaerophoria/videos) + * [Salar Rahmanian](https://www.twitch.tv/softinio) - Transmissions relacionades amb Zig, incloent-hi esdeveniments en línia del grup d'usuaris de Zig de la badia de San Francisco + +# Desenvolupament del compilador +Aquestes comunitats se centren en la col·laboració per al desenvolupament del compilador Zig. + +Avís: Si sou nous i voleu ajuda per aprendre Zig, busqueu comunitats de discussió general que tinguin un espai dedicat a la integració de nouvinguts. + +## Zulip + * [Desenvolupament del compilador ZSF](https://zsf.zulipchat.com/) + - Moderadors: + - [Andrew Kelley](https://andrewkelley.me/) + - [Codi de conducta](/code-of-conduct) diff --git a/content/ca-ES/index.smd b/content/ca-ES/index.smd index 318de3e06..e9cd00db9 100644 --- a/content/ca-ES/index.smd +++ b/content/ca-ES/index.smd @@ -43,7 +43,7 @@ No hi ha concepte d'«oficial» o «no oficial»; tanmateix, cada lloc de reuni ## [Desenvolupament principal]($section.id("main-development")) El repositori de Zig es pot trobar a [https://github.com/ziglang/zig](https://github.com/ziglang/zig), on també allotgem el seguiment d'incidències i discutim propostes. -S'espera que els col·laboradors segueixin el [Codi de conducta](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md) de Zig. +S'espera que els col·laboradors segueixin el [Codi de conducta](/code-of-conduct) de Zig. # [Zig Software Foundation]($section.id("zsf").attrs("section-title")) From db7d58401ac8094ea62738e3bda37c3b6899f723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Thu, 27 Nov 2025 14:02:32 +0900 Subject: [PATCH 5/8] i18n: translate the website title --- zine.ziggy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zine.ziggy b/zine.ziggy index 57879bf3a..4bef8a502 100644 --- a/zine.ziggy +++ b/zine.ziggy @@ -45,7 +45,7 @@ Multilingual { { .code = "ca-ES", .name = "Català", - .site_title = "Zig Programming Language", + .site_title = "El Llenguatge de Programació Zig", .content_dir_path = "content/ca-ES", }, { From 81ca09b7964baa416295d452589c38f030c201d1 Mon Sep 17 00:00:00 2001 From: Jost Alemann Date: Thu, 27 Nov 2025 11:47:00 +0100 Subject: [PATCH 6/8] tools: github -> codeberg --- content/de-DE/learn/tools.smd | 10 +++++----- content/en-US/learn/tools.smd | 10 +++++----- content/es-AR/learn/tools.smd | 10 +++++----- content/it-IT/learn/tools.smd | 10 +++++----- content/ja-JP/learn/tools.smd | 10 +++++----- content/ko-KR/learn/tools.smd | 10 +++++----- content/ru-RU/learn/tools.smd | 10 +++++----- content/uk-UA/learn/tools.smd | 10 +++++----- content/zh-CN/learn/tools.smd | 10 +++++----- 9 files changed, 45 insertions(+), 45 deletions(-) diff --git a/content/de-DE/learn/tools.smd b/content/de-DE/learn/tools.smd index 94d628d8e..cf5063541 100644 --- a/content/de-DE/learn/tools.smd +++ b/content/de-DE/learn/tools.smd @@ -18,22 +18,22 @@ Language-Server sind editorunabhängige Tools, die Syntaxhervorhebung, Autovervo Editor-spezifische Werkzeuge oder Erweiterungen, meist Syntax-Highlighter. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim/Neovim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## JetBrains-Familie ( IntelliJ IDEA, Fleet und weitere) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/en-US/learn/tools.smd b/content/en-US/learn/tools.smd index c55a1ed87..d1c344f8c 100644 --- a/content/en-US/learn/tools.smd +++ b/content/en-US/learn/tools.smd @@ -18,22 +18,22 @@ Language servers are editor-agnostic tools for obtaining syntax highlighting, au Editor-specific tools, mostly syntax highlighters. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## JetBrains family (IntelliJ IDEA, Fleet) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/es-AR/learn/tools.smd b/content/es-AR/learn/tools.smd index 5e4027a2a..06b7b1812 100644 --- a/content/es-AR/learn/tools.smd +++ b/content/es-AR/learn/tools.smd @@ -18,22 +18,22 @@ Los Servidores de Lenguaje son herramientas abiertas a cualquier editor que prov Herramientas para editores específicos, principalmente marcado de sintaxis. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## Familia JetBrains ( IntelliJ IDEA, Fleet, etc) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/it-IT/learn/tools.smd b/content/it-IT/learn/tools.smd index b75d38800..1b606208b 100644 --- a/content/it-IT/learn/tools.smd +++ b/content/it-IT/learn/tools.smd @@ -18,22 +18,22 @@ I *server linguaggio* sono strumenti generici (non legati ad uno specifico edito Strumenti specifici per gli editor di testo, principalmente per evidenziare la sintassi. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## Famiglia JetBrains (IntelliJ IDEA, Fleet e altri) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/ja-JP/learn/tools.smd b/content/ja-JP/learn/tools.smd index 8428f698e..91b9ced6f 100644 --- a/content/ja-JP/learn/tools.smd +++ b/content/ja-JP/learn/tools.smd @@ -18,22 +18,22 @@ エディタ固有のツール、主にシンタックスハイライタ。 ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## JetBrains family (IntelliJ IDEA, Fleet) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/ko-KR/learn/tools.smd b/content/ko-KR/learn/tools.smd index cb91fbc60..7f20b111d 100644 --- a/content/ko-KR/learn/tools.smd +++ b/content/ko-KR/learn/tools.smd @@ -20,22 +20,22 @@ 아래 목록의 확장 프로그램은 구문 강조 기능을 위주로 동작하며, 각 편집기마다 설치해야 하는 확장 프로그램이 다름에 유의하세요. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## JetBrains family (IntelliJ IDEA, Fleet) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/ru-RU/learn/tools.smd b/content/ru-RU/learn/tools.smd index 2137d940d..483825685 100644 --- a/content/ru-RU/learn/tools.smd +++ b/content/ru-RU/learn/tools.smd @@ -18,22 +18,22 @@ Инструменты, специфичные для редакторов, в основном предназначенные для подсветки синтаксиса. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## JetBrains (IntelliJ IDEA, Fleet и другие) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/uk-UA/learn/tools.smd b/content/uk-UA/learn/tools.smd index 7f8fba1a8..72dd62e09 100644 --- a/content/uk-UA/learn/tools.smd +++ b/content/uk-UA/learn/tools.smd @@ -18,22 +18,22 @@ Спеціальні інструменти редактору коду, зазвичай тільки підсвічують текст. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## JetBrains family (IntelliJ IDEA, Fleet і так далі) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) diff --git a/content/zh-CN/learn/tools.smd b/content/zh-CN/learn/tools.smd index 6565d4e50..001f39b77 100644 --- a/content/zh-CN/learn/tools.smd +++ b/content/zh-CN/learn/tools.smd @@ -18,22 +18,22 @@ 特定于编辑器的工具,主要是语法高亮显示工具。 ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## JetBrains family (IntelliJ IDEA, Fleet) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains) From a19c5b3c142f73c3f59e5627d061265f7670ed59 Mon Sep 17 00:00:00 2001 From: Jost Alemann Date: Thu, 27 Nov 2025 11:56:58 +0100 Subject: [PATCH 7/8] zig repo github -> codeberg --- content/de-DE/index.smd | 2 +- content/en-US/index.smd | 2 +- content/es-AR/index.smd | 2 +- content/it-IT/index.smd | 2 +- content/ja-JP/index.smd | 2 +- content/ko-KR/index.smd | 2 +- content/ru-RU/index.smd | 2 +- content/uk-UA/index.smd | 4 ++-- content/zh-CN/index.smd | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/content/de-DE/index.smd b/content/de-DE/index.smd index 7838a4e74..677793011 100644 --- a/content/de-DE/index.smd +++ b/content/de-DE/index.smd @@ -42,7 +42,7 @@ Es gibt kein "offiziell" oder "inoffiziell", jedoch hat jeder Versammlungsort se ## [Projektentwicklung]($section.id("main-development")) -Das Zig-Repository findest du unter [https://github.com/ziglang/zig](https://github.com/ziglang/zig), wo wir auch Fehlermeldungen bearbeiten und Vorschläge diskutieren. +Das Zig-Repository findest du unter [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig), wo wir auch Fehlermeldungen bearbeiten und Vorschläge diskutieren. Mitwirkende müssen sich dabei an den [Verhaltenskodex](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md) von Zig halten. diff --git a/content/en-US/index.smd b/content/en-US/index.smd index df56fea11..f64644b7d 100644 --- a/content/en-US/index.smd +++ b/content/en-US/index.smd @@ -42,7 +42,7 @@ There is no concept of "official" or "unofficial", however, each gathering place ## [Main development]($section.id("main-development")) -The Zig repository can be found at [https://github.com/ziglang/zig](https://github.com/ziglang/zig), where we also host the issue tracker and discuss proposals. +The Zig repository can be found at [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig), where we also host the issue tracker and discuss proposals. Contributors are expected to follow Zig's [Code of Conduct](/code-of-conduct). diff --git a/content/es-AR/index.smd b/content/es-AR/index.smd index e92002a98..5d05e306e 100644 --- a/content/es-AR/index.smd +++ b/content/es-AR/index.smd @@ -42,7 +42,7 @@ No existe el concepto de "oficial" o "no oficial". No obstante, cada lugar de re ## [Desarrollo principal]($section.id("main-development")) -El repositorio de Zig se encuentra en [https://github.com/ziglang/zig](https://github.com/ziglang/zig), donde también hospedamos el seguimiento de incidencias y discutimos propuestas. +El repositorio de Zig se encuentra en [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig), donde también hospedamos el seguimiento de incidencias y discutimos propuestas. Se espera que los contribuidores sigan el [Código de Conducta](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md) de Zig. diff --git a/content/it-IT/index.smd b/content/it-IT/index.smd index f8ad57163..c8062050d 100644 --- a/content/it-IT/index.smd +++ b/content/it-IT/index.smd @@ -42,7 +42,7 @@ Non c'è distinzione tra spazi "ufficiali" e non, ma ogni spazio ha le proprie r ## [Sviluppo del progetto]($section.id("main-development")) -Il repository di Zig può essere trovato a [https://github.com/ziglang/zig](https://github.com/ziglang/zig), dove gestiamo anche le segnalazioni di bug e discutiamo le proposte di miglioramento. +Il repository di Zig può essere trovato a [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig), dove gestiamo anche le segnalazioni di bug e discutiamo le proposte di miglioramento. I contributori sono tenuti a rispettare il [codice di comportamento](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md) di Zig. diff --git a/content/ja-JP/index.smd b/content/ja-JP/index.smd index 2084315d4..238368150 100644 --- a/content/ja-JP/index.smd +++ b/content/ja-JP/index.smd @@ -42,7 +42,7 @@ C/C++/Zigのコードベースを段階的に改善することができます ## [主な開発内容]($section.id("main-development")) -Zigのリポジトリは[https://github.com/ziglang/zig](https://github.com/ziglang/zig)にあります。ここでは、イシュー・トラッカーもホストしており、提案についても議論しています。 +Zigのリポジトリは[https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig)にあります。ここでは、イシュー・トラッカーもホストしており、提案についても議論しています。 コントリビュータはZigの[行動規範](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md)を遵守することが求められます。 diff --git a/content/ko-KR/index.smd b/content/ko-KR/index.smd index 6d11fcbfe..acdf7c331 100644 --- a/content/ko-KR/index.smd +++ b/content/ko-KR/index.smd @@ -45,7 +45,7 @@ C/C++/Zig 코드베이스를 점진적으로 향상시키세요. ## [주요 개발 관련 커뮤니티]($section.id("main-development")) -Zig의 저장소는 [https://github.com/ziglang/zig](https://github.com/ziglang/zig)에 있으며, 이슈 트래킹과 제안에 대한 논의가 여기서 진행됩니다. +Zig의 저장소는 [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig)에 있으며, 이슈 트래킹과 제안에 대한 논의가 여기서 진행됩니다. 프로젝트에 기여하실 분들은 Zig의 [행동 지침](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md)을 준수해야 합니다. diff --git a/content/ru-RU/index.smd b/content/ru-RU/index.smd index 6230b6a5c..e5b60ee8a 100644 --- a/content/ru-RU/index.smd +++ b/content/ru-RU/index.smd @@ -42,7 +42,7 @@ Zig — это язык программирования общего назна ## [Разработка]($section.id("main-development")) -Репозиторий Zig можно найти на [https://github.com/ziglang/zig](https://github.com/ziglang/zig), где мы также ведём трекер проблем и обсуждаем предложения. +Репозиторий Zig можно найти на [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig), где мы также ведём трекер проблем и обсуждаем предложения. От участников ожидается соблюдение [Кодекса поведения Zig](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md). diff --git a/content/uk-UA/index.smd b/content/uk-UA/index.smd index eecd265d3..f657270ff 100644 --- a/content/uk-UA/index.smd +++ b/content/uk-UA/index.smd @@ -42,7 +42,7 @@ Zig — це мова програмування загального призн ## [Головна розробка]($section.id("main-development")) -Репозиторій Zig можна знайти за посиланням [https://github.com/ziglang/zig](https://github.com/ziglang/zig), де ми також розміщуємо трекер проблем і обговорюємо пропозиції. +Репозиторій Zig можна знайти за посиланням [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig), де ми також розміщуємо трекер проблем і обговорюємо пропозиції. Очікується, що учасники слідуватимуть за [Кодексом поведінки](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md) Zig. @@ -60,4 +60,4 @@ Zig Software Foundation підтримується за рахунок поже Наступні компанії надають пряму фінансову підтримку Zig Software Foundation. ## [Спонсори GitHub]($section.id("github-sponsors")) -Завдяки людям, які [спонсорують Zig]($link.page('zsf')), проект підзвітний спільноті з відкритим кодом, а не корпоративним акціонерам. Зокрема, ці чудові люди спонсорують Zig на 200 доларів США на місяць або більше: \ No newline at end of file +Завдяки людям, які [спонсорують Zig]($link.page('zsf')), проект підзвітний спільноті з відкритим кодом, а не корпоративним акціонерам. Зокрема, ці чудові люди спонсорують Zig на 200 доларів США на місяць або більше: diff --git a/content/zh-CN/index.smd b/content/zh-CN/index.smd index 02b5f8998..375e4f162 100644 --- a/content/zh-CN/index.smd +++ b/content/zh-CN/index.smd @@ -41,7 +41,7 @@ Zig 是一种通用的编程语言和工具链,用于维护**健壮**、**高 ## [开发动态]($section.id("main-development")) -Zig 源码仓库可以在 [https://github.com/ziglang/zig](https://github.com/ziglang/zig) 找到,我们同时也在那里跟踪问题和讨论提案。贡献者应该遵守 Zig 的[行为准则](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md)。 +Zig 源码仓库可以在 [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig) 找到,我们同时也在那里跟踪问题和讨论提案。贡献者应该遵守 Zig 的[行为准则](https://github.com/ziglang/zig/blob/master/.github/CODE_OF_CONDUCT.md)。 # [Zig 软件基金会]($section.id("zsf").attrs("section-title")) From b7263a13b20bad80578c4eb5492cdb737b6237e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Fri, 28 Nov 2025 12:37:47 +0900 Subject: [PATCH 8/8] =?UTF-8?q?i18n:=20GitHub=20=E2=86=92=20Codeberg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/ca-ES/index.smd | 2 +- content/ca-ES/learn/getting-started.smd | 2 +- content/ca-ES/learn/tools.smd | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/content/ca-ES/index.smd b/content/ca-ES/index.smd index e9cd00db9..413cc9876 100644 --- a/content/ca-ES/index.smd +++ b/content/ca-ES/index.smd @@ -42,7 +42,7 @@ No hi ha concepte d'«oficial» o «no oficial»; tanmateix, cada lloc de reuni ## [Desenvolupament principal]($section.id("main-development")) -El repositori de Zig es pot trobar a [https://github.com/ziglang/zig](https://github.com/ziglang/zig), on també allotgem el seguiment d'incidències i discutim propostes. +El repositori de Zig es pot trobar a [https://codeberg.org/ziglang/zig](https://codeberg.org/ziglang/zig), on també allotgem el seguiment d'incidències i discutim propostes. S'espera que els col·laboradors segueixin el [Codi de conducta](/code-of-conduct) de Zig. diff --git a/content/ca-ES/learn/getting-started.smd b/content/ca-ES/learn/getting-started.smd index 927194370..4a4ac26f0 100644 --- a/content/ca-ES/learn/getting-started.smd +++ b/content/ca-ES/learn/getting-started.smd @@ -148,7 +148,7 @@ Enhorabona, teniu una instal·lació de Zig funcional! **Doneu un cop d'ull als altres recursos de la secció [Aprendre](/learn)**, assegureu-vos de trobar la documentació de la vostra versió de Zig (nota: les compilacions *nightly* han d'usar la documentació de `master`) i considereu llegir [zig.guide](https://zig.guide). -Zig és un projecte jove i, malauradament, encara no tenim la capacitat de produir documentació i material didàctic extens per a tot. Per això, val la pena [unir-vos a alguna de les comunitats de Zig](https://github.com/ziglang/zig/wiki/Community) +Zig és un projecte jove i, malauradament, encara no tenim la capacitat de produir documentació i material didàctic extens per a tot. Per això, val la pena [unir-vos a alguna de les comunitats de Zig](/community) per rebre ajuda quan us quedeu encallats, així com seguir iniciatives com [Zig SHOWTIME](https://zig.show). Finalment, si us agrada Zig i voleu ajudar a accelerar-ne el desenvolupament, [considereu fer una donació a la Zig Software Foundation](/zsf) diff --git a/content/ca-ES/learn/tools.smd b/content/ca-ES/learn/tools.smd index 41161e61b..13b30e9b5 100644 --- a/content/ca-ES/learn/tools.smd +++ b/content/ca-ES/learn/tools.smd @@ -18,22 +18,22 @@ Els servidors de llenguatge són eines independents de l'editor per obtenir ress Eines específiques de l'editor, principalment ressaltadors de sintaxi. ## VS Code -- [ziglang/vscode-zig](https://github.com/ziglang/vscode-zig) +- [ziglang/vscode-zig](https://codeberg.org/ziglang/vscode-zig) ## Visual Studio - [ZigVS](https://marketplace.visualstudio.com/items?itemName=LuckystarStudio.ZigVS) ## Sublime Text -- [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) +- [ziglang/sublime-zig-language](https://codeberg.org/ziglang/sublime-zig-language) ## Vim -- [ziglang/zig.vim](https://github.com/ziglang/zig.vim) +- [ziglang/zig.vim](https://codeberg.org/ziglang/zig.vim) ## Emacs -- [ziglang/zig-mode](https://github.com/ziglang/zig-mode) +- [ziglang/zig-mode](https://codeberg.org/ziglang/zig-mode) ## Kate -- [ziglang/kde-syntax-highlighting](https://github.com/ziglang/kde-syntax-highlighting) +- [ziglang/kde-syntax-highlighting](https://codeberg.org/ziglang/kde-syntax-highlighting) ## Família JetBrains (IntelliJ IDEA, Fleet) - [ZigBrains](https://plugins.jetbrains.com/plugin/22456-zigbrains)