Skip to content

Commit d9a4729

Browse files
committed
docs: start gems of december
1 parent 9848407 commit d9a4729

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Gems of December 24"
3+
publishedAt: 2024-12-31T00:00:00.000Z
4+
tags:
5+
- Gems of the Month
6+
---
7+
8+
Hopefully back to the habit after a longer trip in Asia.
9+
10+
## Archlinux
11+
12+
### Manage Pacmans mirror list
13+
14+
Archlinux package manager Pacman stores a list of mirrors from which the packages are loaded. This list is located in `/etc/pacman.d/mirrorlist`. [Reflector](https://wiki.archlinux.org/title/Reflector) is a tool to manage this list. When I'm in Switzerland I want to use Swiss mirrors, https only and sorted by the download rate, so I update the list as follows:
15+
16+
```bash
17+
reflector --country Switzerland --age 12 --protocol https --sort rate --download-timeout 10 --save /etc/pacman.d/mirrorlist
18+
```

src/utils/i18n.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { dirname, joinPath } from "./path";
77
import slug from "limax";
88
import { getCollectionSlug, getLocaleSlug } from "./slugs";
99

10-
const PATH_LOCALE_PATTERN =
11-
/^\/?(?<locale>\w{2}(?!\w)(-\w{1,})*)\/?(?<path>.*)?/;
10+
const PATH_LOCALE_PATTERN = /^\/?(?<locale>\w{2}(?!\w)(-\w{1,})*)\/?(?<path>.*)?/;
1211
const FILE_LOCALE_PATTERN = /^(?<path>.*)\.(?<locale>\w{2}(?!\w)(-\w{1,})*)\./;
1312
const LOCALE_PATTERNS = [PATH_LOCALE_PATTERN, FILE_LOCALE_PATTERN];
1413
export const PROTOCOL_DELIMITER = "://";
@@ -26,8 +25,7 @@ export function splitLocaleAndPath(path: string) {
2625
if (!pattern) return undefined;
2726

2827
const match = path.match(pattern);
29-
if (!match || !match.groups || !match.groups.locale || !match.groups.path)
30-
return undefined;
28+
if (!match || !match.groups || !match.groups.locale || !match.groups.path) return undefined;
3129

3230
const l = match.groups.locale;
3331
let p = match.groups.path;
@@ -131,8 +129,7 @@ export async function makeMenu(
131129
return Promise.all(
132130
items.map(async (item) => {
133131
const urlLocale = locale === C.DEFAULT_LOCALE ? "" : locale;
134-
const path =
135-
typeof item.path === "string"
132+
const path = typeof item.path === "string"
136133
? `/${[urlLocale, item.path].filter(Boolean).join("/")}`
137134
: await item.path(locale);
138135
return {
@@ -146,12 +143,12 @@ export async function makeMenu(
146143
export function useTranslations<L extends keyof typeof C.MESSAGES>(locale: L) {
147144
return function t(
148145
key: keyof (typeof C.MESSAGES)[L],
149-
substituions?: Record<string, string | number>,
146+
substitutions?: Record<string, string | number>,
150147
) {
151-
if (substituions) {
148+
if (substitutions) {
152149
let message = C.MESSAGES[locale][key] as string;
153-
for (const key in substituions) {
154-
const value = substituions[key];
150+
for (const key in substitutions) {
151+
const value = substitutions[key];
155152
if (!value) continue;
156153
message = message.replace(`{${key}}`, String(value));
157154
}

0 commit comments

Comments
 (0)