Skip to content

Commit

Permalink
Update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith authored Apr 3, 2023
1 parent a68d0e5 commit 328f747
Show file tree
Hide file tree
Showing 285 changed files with 5,280 additions and 5,449 deletions.
35 changes: 17 additions & 18 deletions src/content/docs/de/_roundtrip_breakpoints.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
---
title: Breakpoints & Images
description: Why some (but not all) breakpoints are important for your images
taskInputHash: 57ab72e7e951b197
taskInputHash: a740eb96e1b2103c
lang: en
ignore: '/* cSpell:locale de,en*/'
date_published: '2023-03-26'
date_modified: '2023-03-31'
date_updated: '2023-03-31'
date_published: '2023-04-03'
date_modified: '2023-04-03'
date_updated: '2023-04-03'
---
### Background

Small screens and big monitors require different layouts. For `srcset` and `sizes`, we need to know when the layout changes.
Small and large screens require different layouts. For `srcset` and `sizes`, we need to know at what point the layout should change.

Web developers need to decide what should be scaled down, hidden, or moved on smaller screens - or decide what should be expanded, revealed, or added on larger screens. They also have very little information available. Is the user on a tablet or phone in landscape mode or in a small browser window?
Web developers must decide what to make smaller or invisible on smaller screens, or larger or add to larger screens. They also have very little information available. Is the user on a tablet, a phone in landscape mode, or a small browser window?

We have to choose an arbitrary viewport width at which the layout changes. This is called a **breakpoint**. It can be any number of CSS pixels ([not device pixels](/en/pixels-not-pixels)). Polypane has a [great article](https://polypane.app/blog/the-breakpoints-we-tested-in-2021-and-the-ones-to-test-in-2022/#the-breakpoints-to-develop-on-in-2023) on commonly used breakpoints.
We need to choose an arbitrary viewport width breakpoint at which the layout changes. This is called a **breakpoint**. It's an arbitrary number of CSS pixels ([not device pixels](/en/pixels-not-pixels)). Polypane has a [great article](https://polypane.app/blog/the-breakpoints-we-tested-in-2021-and-the-ones-to-test-in-2022/#the-breakpoints-to-develop-on-in-2023) on commonly used breakpoints.

Some images (like logos, icons, or buttons) can be immune to the layout shifts caused by these breakpoints (and are okay with [srcset density descriptors](/en/density-descriptors)).
Some images (like logos, icons, or buttons) can be immune to the layout changes caused by these breakpoints (and be fine with [srcset density descriptors](/en/density-descriptors)).

Main content images are limited by the size of their container. Typically, the main area of a page layout is constrained to a specific width, a `max-width`, on the largest screens, but on small screens the main content area fills the entire viewport.
Main content images are limited by the size of their container. Typically, a page's main content is constrained to a specific width on the largest screens, a `max-width`, but on small screens, the main content fills the entire viewport.

When you have more than one column at some breakpoints, it becomes difficult to compute the effective size rules because the percentage of viewport width taken up by the image changes.
If you have more than one column at some breakpoints, it becomes harder to calculate effective sizing rules because the percentage of viewport width the image occupies changes.

### The easy way
### The Easy Method

That doesn't mean you should smash your head against the wall. You will likely get very far with the following approach:
However, you shouldn't think too much about it. You'll probably do well with this approximation method:

1. At what size does the main column (or the container of the image) stop growing? Until that viewport width, we can use `100vw` for the `sizes` attribute of the image to indicate that the image takes up 100% of the viewport width.
2. What is the maximum width the container will ever be? We can set that as a fixed `width` for everything else.
1. At what size does the main column (or image container) stop growing? Until that viewport width, we can use `100vw` for the `sizes` attribute of the image to say that the image is 100% of the viewport width.
2. What is the maximum width the container ever reaches? We can set that as a fixed `width` for everything else.

If your answer to 1 is 700px and your answer to 2 is 800px, you can use the following `sizes` attribute:
If your answer to 1 was 700px and your answer to 2 was 800px, you can use the following `sizes` attribute:

```html
<!-- These are CSS pixels, not device pixels or image pixels. -->
Expand All @@ -38,7 +37,7 @@ If your answer to 1 is 700px and your answer to 2 is 800px, you can use the foll



> You would think that the browser could kindly do all these calculations for us based on the CSS. Unfortunately, browsers are aggressively trying to choose an image URL *before* downloading stylesheets. So we have to do the calculations ourselves. And if we're not perfect, that's their problem.
> One might think that the browser could do all of these calculations for us nicely based on CSS. Unfortunately, browsers aggressively select an image URL *before* downloading the stylesheets. Therefore, we have to do the calculations ourselves, and they're fine with us not getting it perfect.
=====================

Content prompt used:
Expand All @@ -52,7 +51,7 @@ Also carefully translate the title and description for the article; do not use &
2. Why some (but not all) breakpoints matter for your images

Metadata returned1. Breakpoints & Bilder
2. Warum manche (aber nicht alle) Breakpoints wichtig für Ihre Bilder sind
2. Warum einige (aber nicht alle) Breakpoints für Ihre Bilder wichtig sind


Roundtrip (isolated) prompt used:
Expand Down
47 changes: 26 additions & 21 deletions src/content/docs/de/_roundtrip_browser-picks-srcset.txt
Original file line number Diff line number Diff line change
@@ -1,67 +1,72 @@
---
title: How the Browser selects
description: How the browser selects between images listed in the "srcset" attribute
taskInputHash: 21fa78dd27583003
title: How Browsers Choose
description: >-
How browsers choose between images listed in the srcset attribute
taskInputHash: 09ab2b098b259019
lang: en
date_published: '2023-04-03'
date_modified: '2023-04-03'
date_updated: '2023-04-03'
---
How does the browser select between images listed in the "srcset" attribute? Here is a step-by-step guide with examples for both width and density descriptors and how the browser decides based on the device and viewport.
How does the browser decide between images listed in the `srcset` attribute? Here is a step-by-step guide with examples for both width and density specifications, and how the browser decides based on device and viewport.

- When using the "srcset" attribute in HTML, the browser uses a set of rules to select the most suitable image from a list of provided sources. These rules depend on both the display characteristics of the device (resolution, pixel density) and the size of the viewport. The "srcset" attribute allows you to specify different images based on width (using the "w" descriptor) or pixel density (using the "x" descriptor). Let's go through examples for both cases.
- When the `srcset` attribute is used in HTML, the browser uses a set of rules to select the best image from a list of provided sources. These rules depend on the display properties (resolution, pixel density) of the device and the size of the viewport. The `srcset` attribute allows you to specify different images based on width (using `w` descriptor) or pixel density (using `x` descriptor). Let's go through each case with examples.

1. Width descriptor ("w"):
1. Width Descriptor (`w`):

Assuming we have the following "srcset" attribute:
Assuming we have the following `srcset` attribute:

```html

<img src="example-small.jpg" srcset="example-small.jpg 400w, example-medium.jpg 800w, example-large.jpg 1600w" alt="Example image">
<img src="example-small.jpg" srcset="example-small.jpg 400w, example-medium.jpg 800w, example-large.jpg 1600w" alt="example image">

```

The browser will perform the following steps:
The browser will perform these steps:

a. Determine the DPR (Device Pixel Ratio) of the device. For instance, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.
a. Determine the DPR (Device Pixel Ratio) of the device. For example, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.

b. Calculate the effective width for each image in the "srcset". Multiply the width descriptor by the DPR. For a device with a DPR of 1:
b. Calculate the effective width for each image in the `srcset`. Multiply the width descriptor by the DPR. For a device with a DPR of 1:

- example-small.jpg: 400 * 1 = 400px

- example-medium.jpg: 800 * 1 = 800px

- example-large.jpg: 1600 * 1 = 1600px

c. Compare the effective widths to the viewport width. Assuming the viewport width is 420px, the browser selects the smallest image whose effective width is greater than or equal to the viewport width. In this case, "example-medium.jpg" is selected.
c. Compare the effective widths with the viewport width. Assuming the viewport width is 420px. The browser selects the smallest image with an effective width that is greater than or equal to the viewport width. In this case, it will select `example-medium.jpg`.

2. Density descriptor ("x"):
2. Pixel Density Descriptor (`x`):

Assuming we have the following "srcset" attribute:
Assuming we have the following `srcset` attribute:

```html

<img src="example-1x.jpg" srcset="example-1x.jpg 1x, example-2x.jpg 2x, example-3x.jpg 3x" alt="Example image">
<img src="example-1x.jpg" srcset="example-1x.jpg 1x, example-2x.jpg 2x, example-3x.jpg 3x" alt="example image">

```

The browser will perform the following steps:
The browser will perform these steps:

a. Determine the DPR (Device Pixel Ratio) of the device. For instance, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.
a. Determine the DPR (Device Pixel Ratio) of the device. For example, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.

b. Compare the device's DPR with the "x" descriptors in the "srcset". In this case, we have three images with the following descriptors:
b. Compare the device's DPR with the `x` descriptors in the `srcset`. In this case, we have three images with the following descriptors:

- example-1x.jpg: 1x

- example-2x.jpg: 2x

- example-3x.jpg: 3x

c. Select the image with the "x" descriptor closest to the device's DPR. For a device with a DPR of 1, the browser selects "example-1x.jpg". For a device with a DPR of 2, it selects "example-2x.jpg", and so on.
c. Select the image with the `x` descriptor that is closest to the device's DPR. For a device with a DPR of 1, the browser selects `example-1x.jpg`. For a device with a DPR of 2, it will select `example-2x.jpg`, and so on.

It is important to note that you can also use the "sizes" attribute in combination with the "srcset" attribute to provide further information on how the image should display at different viewport widths. This is particularly useful when using the width descriptor ("w"). Here is an example:
It is important to note that you can use the `sizes` attribute in combination with the `srcset` attribute to provide more information on how the image will be displayed at various viewport widths. This is particularly useful when using the width descriptor (`w`). Here is an example:

```html

<img src="example-small.jpg" srcset="example-small.jpg 400w, example-medium.jpg 800w, example-large.jpg 1600w" sizes="(max-width: 480px) 100vw, (max-width: 960px) 50vw,

```
=====================

Content prompt used:
Expand All @@ -75,7 +80,7 @@ Also carefully translate the title and description for the article; do not use &
2. How the browser chooses between images listed in the srcset attribute

Metadata returned1. Wie der Browser auswählt
2. Wie der Browser zwischen Bildern im "srcset"-Attribut auswählt
2. Wie der Browser zwischen Bildern wählt, die im srcset Attribut aufgelistet sind


Roundtrip (isolated) prompt used:
Expand Down
47 changes: 23 additions & 24 deletions src/content/docs/de/_roundtrip_density-descriptors.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
---
title: Density descriptors and srcset
description: Examples of using density descriptors in `srcset`
taskInputHash: 0a85d4f28fee785a
title: Density Descriptors & Srcset
description: Examples of using Density Descriptors in `srcset`
taskInputHash: bb5fed05291ed4a0
lang: en
ignore: '/* cSpell:locale de,en*/'
date_published: '2023-03-26'
date_modified: '2023-03-31'
date_updated: '2023-03-31'
date_published: '2023-04-03'
date_modified: '2023-04-03'
date_updated: '2023-04-03'
---
Srcset with density descriptors provides a simple and effective method for delivering the most appropriate image for each user's device, improving performance and user experience. This guide will take you through the basics of using srcset with density descriptors and provide markup examples for your convenience.
Srcset with density descriptors provides an easy and effective way to provide the most suitable image to each user's device, improving performance and user experience. This guide walks you through the basics of using srcset with density descriptors, and provides markup examples for your convenience.

## What is srcset with density descriptors?
## What is Srcset with Density Descriptors?

Srcset is an HTML attribute that allows you to specify multiple image sources for a single `<img>` element. Density descriptors (`x`) are used in conjunction with srcset to provide images at different resolutions based on the pixel density of the user's display.
Srcset is an HTML attribute that allows you to specify multiple image sources for a single `<img>` element. Density descriptors (`x`) are used in conjunction with srcset to provide different resolutions of images based on the pixel density of the user's display.

## When to use srcset with density descriptors?
## When to use Srcset with Density Descriptors?

Using srcset with density descriptors is especially useful when you:
1. Want to provide high resolution images for high DPI displays (e.g. Retina displays) while using lower resolutions for standard displays.
2. Want to improve page rendering by providing the most appropriate image size for each user's device.
Using srcset with density descriptors is particularly useful when you want to:
1. provide high-resolution images on high-resolution displays (e.g. Retina displays) while providing lower resolutions on other displays.
2. improve page performance by providing the most suitable image size to each user's device.

## Implementing srcset with density descriptors
## Implementing Srcset with Density Descriptors

To use srcset with density descriptors, follow these steps:
Follow these steps to use srcset with density descriptors:
1. Prepare your images in different resolutions.
2. Add the `srcset` attribute to the `<img>` element, including the image sources and corresponding density descriptors.
3. Optionally, add the `sizes` attribute to set the size of the image on the screen.
3. Add the `sizes` attribute (optional) to specify the size of the image as it is displayed on the screen.

### Markup example
### Markup Example

Here is an example of how to implement srcset with density descriptors in your markup:
Here is an example of how you can implement srcset with density descriptors in your markup:

```html
<img src="example-image-1x.jpg"
Expand All @@ -38,9 +37,9 @@ Here is an example of how to implement srcset with density descriptors in your m
```

This markup example includes:
- **src**: The default image source to be displayed when the browser does not support srcset.
- **srcset**: The list of image sources and their density descriptors (1x, 2x, 3x). The browser chooses the most appropriate image based on the user's display.
- **alt**: A description of the image for accessibility purposes.
- **src:** The default image source that will be displayed if the browser does not support srcset.
- **srcset:** The list of image sources and their density descriptors (1x, 2x, 3x). The browser chooses the most suitable image based on the user's display.
- **alt:** A description of the image for accessibility and accessibility.

And that's it! You have successfully implemented srcset with density descriptors, improving the performance and user experience of your website.
=====================
Expand All @@ -55,8 +54,8 @@ Also carefully translate the title and description for the article; do not use &
1. Density descriptors & srcset
2. Examples of using density descriptors in `srcset`

Metadata returned1. Density-Descriptoren und Srcset
2. Beispiele für die Verwendung von Density-Descriptoren in `srcset`
Metadata returned1. Density-Deskriptoren & Srcset
2. Beispiele zur Verwendung von Density-Deskriptoren in `srcset`


Roundtrip (isolated) prompt used:
Expand Down
Loading

0 comments on commit 328f747

Please sign in to comment.