@discord/intl 0.15.0 → 0.16.0-canary.3c30ce5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +59 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # `@discord/intl`
2
+
3
+ Redefined internationalization support, created by Discord to manage millions of messages across multiple projects, multiple programming languages, and multiple client platforms. discord-intl supports an expanded message format that combines ICU MessageFormat syntax with Markdown to make authoring rich, stylized messages as clear and concise as possible.
4
+
5
+ This project was born out of a need for more flexibility with our translations, a desire for granular ownership, and a need to refactor to keep up with modern versions of `intl-messageformat` and others that power the system.
6
+
7
+ ## Usage
8
+
9
+ You most likely only need to know about how to use `defineMessages` to write new strings and string modules. A message
10
+ definition file _must_ have the extension `.messages.js`, and _must_ have a default export that calls `defineMessages`
11
+ inline, like this:
12
+
13
+ ```typescript
14
+ // Import the defineMessages magic function from the package.
15
+ import { defineMessages } from '@discord/intl';
16
+
17
+ /**
18
+ * Meta information about the strings contained in this file. Each string will
19
+ * be tagged with this information by default, and it will be sent along to
20
+ * translators to help provide context, categorization, and some special
21
+ * features like hiding "secret" strings that shouldn't be bundled until a
22
+ * specific release date.
23
+ *
24
+ * Future additions would be able to specify visual context for each string
25
+ * (e.g. a screenshot image where the string is used) and more.
26
+ */
27
+ export const meta = {
28
+ project: 'custom-status',
29
+ secret: true,
30
+ translate: true,
31
+ };
32
+
33
+ /**
34
+ * Messages are "defined" by creating a default export with `defineMessages`.
35
+ * This function provides the typeguards for the shape of each message, and
36
+ * ensures a consistent format for the external tooling to rely on when finding
37
+ * all messages in the codebase.
38
+ *
39
+ * This _must_ be defined inline as a default export, and will be transformed
40
+ * by bundlers both in development and production builds.
41
+ */
42
+ export default defineMessages({
43
+ HELLO_WORLD: {
44
+ defaultMessage: 'Hello, world!',
45
+ description: 'The standard greeting for new computers.',
46
+ },
47
+ });
48
+ ```
49
+
50
+ ## Development
51
+
52
+ This project is managed with the `intl-cli`:
53
+
54
+ ```shell
55
+ # Compile the TypeScript source to distributable JavaScript once
56
+ pnpm intl-cli runtime build
57
+ # For development, run in watch mode to compile changes on the fly
58
+ pnpm intl-cli rt watch
59
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discord/intl",
3
- "version": "0.15.0",
3
+ "version": "0.16.0-canary.3c30ce5",
4
4
  "license": "MIT",
5
5
  "description": "Client runtime for managing messages and translations in a React project.",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "@formatjs/intl": "^2.10.1",
24
24
  "@intrnl/xxhash64": "^0.1.2",
25
25
  "intl-messageformat": "^10.5.11",
26
- "@discord/intl-ast": "0.15.0"
26
+ "@discord/intl-ast": "0.16.0-canary.3c30ce5"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@swc/cli": "^0.3.12",