浏览代码

Documented translations

父节点
当前提交
8985b2541a
签署人:: Brendan Abolivier <contact@brendanabolivier.com> GPG 密钥 ID: 8EF1500759F70623
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 11
    3
      README.md

+ 11
- 3
README.md 查看文件

@@ -78,15 +78,18 @@ First, you must rename the `settings.example.conf` into `settings.conf`, and edi
78 78
         "you@example.tld",
79 79
         "someone.else@example.com"
80 80
     ],
81
-    "formOrigin": "https://example.tld"
81
+    "formOrigin": "https://example.tld",
82
+    "language": "en"
82 83
 }
83 84
 ```
84 85
 
85 86
 The `mailserver` section is the set of parameters which will be passed to nodemailer's transporter initialisation, describing the output mail server and following the same structure as the `option` object in [nodemailer's SMTP configuration section](https://github.com/nodemailer/nodemailer#set-up-smtp). Please head there to have the full list of parameters.
86 87
 
87
-The `recipients` server is an array containing the e-mail addresses any message sent via the form will be sent to. Just write down the form's recipient(s)'s addresse(s).
88
+The `recipients` section is an array containing the e-mail addresses any message sent via the form will be sent to. Just write down the form's recipient(s)'s addresse(s).
88 89
 
89
-Finally, the `formOrigin` part is a string containing the origin of the page you'll include the contact form into. This allows SMAM to work with the [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) security most browser use. For more info on how to fill this field, and what is an origin, please give a look at [the MDN's definition](https://developer.mozilla.org/en-US/docs/Glossary/origin).
90
+The `formOrigin` part is a string containing the origin of the page you'll include the contact form into. This allows SMAM to work with the [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) security most browser use. For more info on how to fill this field, and what is an origin, please give a look at [the MDN's definition](https://developer.mozilla.org/en-US/docs/Glossary/origin).
91
+
92
+Finally, the `language` string tells SMAM in which language you want your form served. Possible values are all the files in `locales/`'s names (without the `.json`). To create your own translation, please read the section below.
90 93
 
91 94
 ## Templating
92 95
 
@@ -125,6 +128,11 @@ Now it's all yours to make good use of all these identifiers and have a magnific
125 128
 
126 129
 I think that the code in itself is clear enough, if not please tell me so I can detail everything here!
127 130
 
131
+## Translating
132
+
133
+Right now, SMAM is only available in French and English. If you want to implement your own language, you can do so by creating a new file in the `locales/` directory, named following your language's identifier with the `.json` extension (`en.json` for exemple). You can then have a look at the strings in `en.json`, copy them and translate them in your language. To use this translation, just set the `language` field (in your settings file) to your language's identifier.
134
+
135
+As I don't speak all languages, [pull requests](#contribute) with new languages are more than welcome! You'd be sharing your knowledge with the whole community and help more people using SMAM around the world :smile:
128 136
 
129 137
 ## Contribute
130 138