-
Notifications
You must be signed in to change notification settings - Fork 0
/
l10n.yaml
26 lines (26 loc) · 1.09 KB
/
l10n.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "CHARTNAME.fullname" . }}-l10n
labels:
app.kubernetes.io/name: {{ include "CHARTNAME.name" . }}
helm.sh/chart: {{ include "CHARTNAME.chart" . }}
app.kubernetes.io/instance: {{ INSTANCE }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.partOf }}
app.kubernetes.io/part-of: {{ tpl .Values.partOf . }}
{{- end }}
object.ravin.soc1.ir/type: l10n
annotations:
object.ravin.soc1.ir/priority: "1"
data:
{{- $content := tpl (.Files.Get "chart.l10n") . }}
{{/* Remove all sub-chart translations */}}
{{- $baseContent := regexReplaceAll "(?ms)(\\n)*^\\[.*" $content "" }}
{{/*
Convert to YAML format. Quote the string so that escape chars will work
But replace \s with the space char since it is not supported in YAML
*/}}
{{- $baseContent = regexReplaceAll "([^\\\\](\\\\{2})*)\\\\s" $baseContent "${1} " }}
{{- $yamlContent := regexReplaceAll "(.*?)=(.*)" $baseContent "${1}: \"${2}\"" }}
{{- regexReplaceAll "(.*?)\\[(.*?)\\]?: (.*)" $yamlContent "${1}.${2}: ${3}" | nindent 2 }}