Skip to content

Commit a865f63

Browse files
committed
add license
1 parent f452aae commit a865f63

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

src/i18n/config.ts

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,49 @@
1-
// src/i18n/config.ts
1+
/**
2+
* @license
3+
* Copyright 2025 Porpoiseful LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
217

3-
// Core i18next library.
18+
/**
19+
* @fileoverview Configuration for i18n
20+
* @author [email protected] (Alan Smith)
21+
*
22+
* This is mostly borrowed with a few adaptations from
23+
* https://phrase.com/blog/posts/localizing-react-apps-with-i18next/
24+
*/
425
import i18n from "i18next";
526
import HttpApi from "i18next-http-backend";
6-
// Bindings for React: allow components to
7-
// re-render when language changes.
827
import { initReactI18next } from "react-i18next";
928

1029
i18n
11-
// Wire up the backend as a plugin.
30+
// Add backend as a plugin so we can load the needed translation at runtime
1231
.use(HttpApi)
13-
// Add React bindings as a plugin.
32+
// Add React bindings as a plugin so it will re-render when language changes
1433
.use(initReactI18next)
15-
// Initialize the i18next instance.
1634
.init({
1735
// Config options
1836

1937
// Specifies the default language (locale) used
2038
// when a user visits our site for the first time.
21-
// We use English here, but feel free to use
22-
// whichever locale you want.
2339
lng: "en",
2440

25-
// Fallback locale used when a translation is
26-
// missing in the active locale. Again, use your
27-
// preferred locale here.
41+
// Fallback locale used when a translation is missing.
2842
fallbackLng: "en",
2943

30-
// Normally, we want `escapeValue: true` as it
31-
// ensures that i18next escapes any code in
32-
// translation messages, safeguarding against
33-
// XSS (cross-site scripting) attacks. However,
34-
// React does this escaping itself, so we turn
35-
// it off in i18next.
44+
// Normally, we want `escapeValue: true` as it ensures that i18next escapes any code in
45+
// translation messages, safeguarding against XSS (cross-site scripting) attacks. However,
46+
// React does this escaping itself, so we turn it off in i18next.
3647
interpolation: {
3748
escapeValue: false,
3849
},

0 commit comments

Comments
 (0)