Use folder structure instead of underscores in filenames
[GitHub/WoltLab/woltlab.github.io.git] / docs / view / languages-naming-conventions.md
1 # Language Naming Conventions
2
3 This page contains general rules for naming language items and for their values.
4 API-specific rules are listed on the relevant API page:
5
6 - [Comments](../php/api/comments.md#language-items)
7
8
9 ## Forms
10
11 ### Fields
12
13 If you have an application `foo` and a database object `foo\data\bar\Bar` with a property `baz` that can be set via a form field, the name of the corresponding language item has to be `foo.bar.baz`.
14 If you want to add an additional description below the field, use the language item `foo.bar.baz.description`.
15
16 ### Error Texts
17
18 If an error of type `{error type}` for the previously mentioned form field occurs during validation, you have to use the language item `foo.bar.baz.error.{error type}` for the language item describing the error.
19
20 Exception to this rule:
21 There are several general error messages like `wcf.global.form.error.empty` that have to be used for general errors like an empty field that may not be empty to avoid duplication of the same error message text over and over again in different language items.
22
23 #### Naming Conventions
24
25 - If the entered text does not conform to some special rules, i.e. if the text is invalid, use `invalid` as error type.
26 - If the entered text is required to be unique but is already used for another object, use `notUnique` as error type.
27
28
29 ## Confirmation messages
30
31 If the language item for an action is `foo.bar.action`, the language item for the confirmation message has to be `foo.bar.action.confirmMessage` instead of `foo.bar.action.sure` which is still used by some older language items.
32
33 ### Type-Specific Deletion Confirmation Message
34
35 #### German
36
37 ```
38 {if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} {element type} wirklich löschen?
39 ```
40
41 Example:
42
43 ```
44 {if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} das Icon wirklich löschen?
45 ```
46
47 #### English
48
49 ```
50 Do you really want delete the {element type}?
51 ```
52
53 Example:
54
55 ```
56 Do you really want delete the icon?
57 ```
58
59 ### Object-Specific Deletion Confirmation Message
60
61 #### German
62
63 ```
64 {if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} {element type} <span class="confirmationObject">{object name}</span> wirklich löschen?
65 ```
66
67 Example:
68
69 ```
70 {if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} den Artikel <span class="confirmationObject">{$article->getTitle()}</span> wirklich löschen?
71 ```
72
73 #### English
74
75 ```
76 Do you really want to delete the {element type} <span class="confirmationObject">{object name}</span>?
77 ```
78
79 Example:
80
81 ```
82 Do you really want to delete the article <span class="confirmationObject">{$article->getTitle()}</span>?
83 ```
84
85
86 ## User Group Options
87
88 ### Comments
89
90 #### German
91
92 | group type | action | example permission name | language item |
93 | ---------- | ------ | ----------------------- | ------------- |
94 | user | adding | `user.foo.canAddComment` | `Kann Kommentare erstellen` |
95 | user | deleting | `user.foo.canDeleteComment` | `Kann eigene Kommentare löschen` |
96 | user | editing | `user.foo.canEditComment` | `Kann eigene Kommentare bearbeiten` |
97 | moderator | deleting | `mod.foo.canDeleteComment` | `Kann Kommentare löschen` |
98 | moderator | editing | `mod.foo.canEditComment` | `Kann Kommentare bearbeiten` |
99 | moderator | moderating | `mod.foo.canModerateComment` | `Kann Kommentare moderieren` |
100
101 #### English
102
103 | group type | action | example permission name | language item |
104 | ---------- | ------ | ----------------------- | ------------- |
105 | user | adding | `user.foo.canAddComment` | `Can create comments` |
106 | user | deleting | `user.foo.canDeleteComment` | `Can delete their comments` |
107 | user | editing | `user.foo.canEditComment` | `Can edit their comments` |
108 | moderator | deleting | `mod.foo.canDeleteComment` | `Can delete comments` |
109 | moderator | editing | `mod.foo.canEditComment` | `Can edit comments` |
110 | moderator | moderating | `mod.foo.canModerateComment` | `Can moderate comments` |