Skip to content

Commit

Permalink
fix i18n & rename i18n source
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Madigan <[email protected]>
  • Loading branch information
jasonmadigan committed Oct 14, 2024
1 parent 79776f3 commit f99d604
Show file tree
Hide file tree
Showing 22 changed files with 178 additions and 173 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ Install via the [`kuadrant-operator`](https://www.github.com/kuadrant/kuadrant-o
The plugin template demonstrates how you can translate messages in with [react-i18next](https://react.i18next.com/). The i18n namespace must match
the name of the `ConsolePlugin` resource with the `plugin__` prefix to avoid
naming conflicts. For example, the plugin template uses the
`plugin__console-plugin-template` namespace. You can use the `useTranslation` hook
`plugin__kuadrant-console` namespace. You can use the `useTranslation` hook
with this namespace as follows:

```tsx
conster Header: React.FC = () => {
const { t } = useTranslation('plugin__console-plugin-template');
const { t } = useTranslation('plugin__kuadrant-console-plugin');
return <h1>{t('Hello, World!')}</h1>;
};
```

For labels in `console-extensions.json`, you can use the format
`%plugin__console-plugin-template~My Label%`. Console will replace the value with
the message for the current language from the `plugin__console-plugin-template`
`%plugin__kuadrant-console-plugin~My Label%`. Console will replace the value with
the message for the current language from the `plugin__kuadrant-console`
namespace. For example:

```json
Expand All @@ -121,7 +121,7 @@ namespace. For example:
"properties": {
"id": "admin-demo-section",
"perspective": "admin",
"name": "%plugin__console-plugin-template~Plugin Template%"
"name": "%plugin__kuadrant-console-plugin~Plugin Template%"
}
}
```
Expand Down
16 changes: 8 additions & 8 deletions console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@
"type": "console.navigation/section",
"properties": {
"id": "kuadrant-section-admin",
"name": "%plugin__console-plugin-template~Kuadrant%",
"name": "%plugin__kuadrant-console-plugin~Kuadrant%",
"perspective": "admin"
}
},
{
"type": "console.navigation/href",
"properties": {
"id": "kuadrant-overview-admin",
"name": "%plugin__console-plugin-template~Overview%",
"name": "%plugin__kuadrant-console-plugin~Overview%",
"href": "/kuadrant/overview",
"perspective": "admin",
"section": "kuadrant-section-admin"
Expand All @@ -92,7 +92,7 @@
"type": "console.navigation/href",
"properties": {
"id": "kuadrant-policies-admin",
"name": "%plugin__console-plugin-template~Policies%",
"name": "%plugin__kuadrant-console-plugin~Policies%",
"href": "/kuadrant/all-namespaces/policies",
"perspective": "admin",
"section": "kuadrant-section-admin"
Expand All @@ -102,7 +102,7 @@
"type": "console.navigation/href",
"properties": {
"id": "kuadrant-policy-topology-admin",
"name": "%plugin__console-plugin-template~Policy Topology%",
"name": "%plugin__kuadrant-console-plugin~Policy Topology%",
"href": "/kuadrant/policy-topology",
"perspective": "admin",
"section": "kuadrant-section-admin",
Expand All @@ -113,15 +113,15 @@
"type": "console.navigation/section",
"properties": {
"id": "kuadrant-section-dev",
"name": "%plugin__console-plugin-template~Kuadrant%",
"name": "%plugin__kuadrant-console-plugin~Kuadrant%",
"perspective": "dev"
}
},
{
"type": "console.navigation/href",
"properties": {
"id": "kuadrant-dashboard-dev",
"name": "%plugin__console-plugin-template~Overview%",
"name": "%plugin__kuadrant-console-plugin~Overview%",
"href": "/kuadrant/overview",
"perspective": "dev",
"section": "kuadrant-section-dev"
Expand All @@ -131,7 +131,7 @@
"type": "console.navigation/href",
"properties": {
"id": "kuadrant-policies-dev",
"name": "%plugin__console-plugin-template~Policies%",
"name": "%plugin__kuadrant-console-plugin~Policies%",
"href": "/kuadrant/all-namespaces/policies",
"perspective": "dev",
"section": "kuadrant-section-dev"
Expand All @@ -141,7 +141,7 @@
"type": "console.navigation/href",
"properties": {
"id": "kuadrant-policy-topology-dev",
"name": "%plugin__console-plugin-template~Policy Topology%",
"name": "%plugin__kuadrant-console-plugin~Policy Topology%",
"href": "/kuadrant/policy-topology",
"perspective": "dev",
"section": "kuadrant-section-dev",
Expand Down
2 changes: 1 addition & 1 deletion i18next-parser.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
locales: ['en'],
namespaceSeparator: '~',
reactNamespace: false,
defaultNamespace: 'plugin__console-plugin-template',
defaultNamespace: 'plugin__kuadrant-console-plugin',
useKeysAsDefaultValue: true,

// see below for more details
Expand Down
66 changes: 33 additions & 33 deletions install.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
apiVersion: v1
kind: Namespace
metadata:
name: kuadrant-console
name: kuadrant-console-plugin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kuadrant-console
namespace: kuadrant-console
name: kuadrant-console-plugin
namespace: kuadrant-console-plugin
labels:
app: kuadrant-console
app.kubernetes.io/component: kuadrant-console
app.kubernetes.io/instance: kuadrant-console
app.kubernetes.io/name: kuadrant-console
app.kubernetes.io/part-of: kuadrant-console
app.openshift.io/runtime-namespace: kuadrant-console
app: kuadrant-console-plugin
app.kubernetes.io/component: kuadrant-console-plugin
app.kubernetes.io/instance: kuadrant-console-plugin
app.kubernetes.io/name: kuadrant-console-plugin
app.kubernetes.io/part-of: kuadrant-console-plugin
app.openshift.io/runtime-namespace: kuadrant-console-plugin
spec:
replicas: 1
selector:
matchLabels:
app: kuadrant-console
app: kuadrant-console-plugin
template:
metadata:
labels:
app: kuadrant-console
app.kubernetes.io/component: kuadrant-console
app.kubernetes.io/instance: kuadrant-console
app.kubernetes.io/name: kuadrant-console
app.kubernetes.io/part-of: kuadrant-console
app: kuadrant-console-plugin
app.kubernetes.io/component: kuadrant-console-plugin
app.kubernetes.io/instance: kuadrant-console-plugin
app.kubernetes.io/name: kuadrant-console-plugin
app.kubernetes.io/part-of: kuadrant-console-plugin
spec:
containers:
- name: kuadrant-console
- name: kuadrant-console-plugin
image: quay.io/kuadrant/console-plugin:latest
ports:
- containerPort: 9443
Expand Down Expand Up @@ -70,13 +70,13 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
namespace: kuadrant-console
namespace: kuadrant-console-plugin
labels:
app: kuadrant-console
app.kubernetes.io/component: kuadrant-console
app.kubernetes.io/instance: kuadrant-console
app.kubernetes.io/name: kuadrant-console
app.kubernetes.io/part-of: kuadrant-console
app: kuadrant-console-plugin
app.kubernetes.io/component: kuadrant-console-plugin
app.kubernetes.io/instance: kuadrant-console-plugin
app.kubernetes.io/name: kuadrant-console-plugin
app.kubernetes.io/part-of: kuadrant-console-plugin
data:
nginx.conf: |
error_log /dev/stdout;
Expand Down Expand Up @@ -111,34 +111,34 @@ kind: Service
metadata:
annotations:
service.alpha.openshift.io/serving-cert-secret-name: plugin-serving-cert
name: kuadrant-console
namespace: kuadrant-console
name: kuadrant-console-plugin
namespace: kuadrant-console-plugin
labels:
app: kuadrant-console
app.kubernetes.io/component: kuadrant-console
app.kubernetes.io/instance: kuadrant-console
app.kubernetes.io/name: kuadrant-console
app.kubernetes.io/part-of: kuadrant-console
app: kuadrant-console-plugin
app.kubernetes.io/component: kuadrant-console-plugin
app.kubernetes.io/instance: kuadrant-console-plugin
app.kubernetes.io/name: kuadrant-console-plugin
app.kubernetes.io/part-of: kuadrant-console-plugin
spec:
ports:
- name: 9443-tcp
protocol: TCP
port: 9443
targetPort: 9443
selector:
app: kuadrant-console
app: kuadrant-console-plugin
type: ClusterIP
sessionAffinity: None
---
apiVersion: console.openshift.io/v1alpha1
kind: ConsolePlugin
metadata:
name: kuadrant-console
name: kuadrant-console-plugin
spec:
displayName: 'Kuadrant Console Plugin'
service:
name: kuadrant-console
namespace: kuadrant-console
name: kuadrant-console-plugin
namespace: kuadrant-console-plugin
port: 9443
basePath: '/'

Loading

0 comments on commit f99d604

Please sign in to comment.