mirror of https://github.com/vector-im/riot-web
Enable proper i18n for date utils
parent
573ababb8c
commit
716e2effbc
|
@ -138,19 +138,14 @@ export function wantsDateSeparator(prevEventDate: Date, nextEventDate: Date): bo
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatFullDateNoDay(date: Date) {
|
export function formatFullDateNoDay(date: Date) {
|
||||||
return (
|
return _t("%(year)s-%(month)s-%(day)s at %(hours)s.%(minutes)s.%(seconds)s", {
|
||||||
date.getFullYear() +
|
year: date.getFullYear(),
|
||||||
"-" +
|
month: pad(date.getMonth() + 1),
|
||||||
pad(date.getMonth() + 1) +
|
day: pad(date.getDate()),
|
||||||
"-" +
|
hours: pad(date.getHours()),
|
||||||
pad(date.getDate()) +
|
minutes: pad(date.getMinutes()),
|
||||||
_t(" at ") +
|
seconds: pad(date.getSeconds()),
|
||||||
pad(date.getHours()) +
|
});
|
||||||
"." +
|
|
||||||
pad(date.getMinutes()) +
|
|
||||||
"." +
|
|
||||||
pad(date.getSeconds())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatFullDateNoDayNoTime(date: Date) {
|
export function formatFullDateNoDayNoTime(date: Date) {
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
"%(weekDayName)s, %(monthName)s %(day)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(time)s",
|
"%(weekDayName)s, %(monthName)s %(day)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(time)s",
|
||||||
"%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s": "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s",
|
"%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s": "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s",
|
||||||
"%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s",
|
"%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s",
|
||||||
" at ": " at ",
|
"%(year)s-%(month)s-%(day)s at %(hours)s.%(minutes)s.%(seconds)s": "%(year)s-%(month)s-%(day)s at %(hours)s.%(minutes)s.%(seconds)s",
|
||||||
"Who would you like to add to this community?": "Who would you like to add to this community?",
|
"Who would you like to add to this community?": "Who would you like to add to this community?",
|
||||||
"Warning: any person you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID",
|
"Warning: any person you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID",
|
||||||
"Invite new community members": "Invite new community members",
|
"Invite new community members": "Invite new community members",
|
||||||
|
@ -728,7 +728,7 @@
|
||||||
"Share your public space": "Share your public space",
|
"Share your public space": "Share your public space",
|
||||||
"Unknown App": "Unknown App",
|
"Unknown App": "Unknown App",
|
||||||
"%(creatorName)s created this room.": "%(creatorName)s created this room.",
|
"%(creatorName)s created this room.": "%(creatorName)s created this room.",
|
||||||
"This is the start of export of <b>%(roomName)s</b>.\n Exported by %(exporterDetails)s at %(exportDate)s. ": "This is the start of export of <b>%(roomName)s</b>.\n Exported by %(exporterDetails)s at %(exportDate)s. ",
|
"This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.": "This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.",
|
||||||
"Topic: %(topic)s": "Topic: %(topic)s",
|
"Topic: %(topic)s": "Topic: %(topic)s",
|
||||||
"Help us improve %(brand)s": "Help us improve %(brand)s",
|
"Help us improve %(brand)s": "Help us improve %(brand)s",
|
||||||
"Send <UsageDataLink>anonymous usage data</UsageDataLink> which helps us improve %(brand)s. This will use a <PolicyLink>cookie</PolicyLink>.": "Send <UsageDataLink>anonymous usage data</UsageDataLink> which helps us improve %(brand)s. This will use a <PolicyLink>cookie</PolicyLink>.",
|
"Send <UsageDataLink>anonymous usage data</UsageDataLink> which helps us improve %(brand)s. This will use a <PolicyLink>cookie</PolicyLink>.": "Send <UsageDataLink>anonymous usage data</UsageDataLink> which helps us improve %(brand)s. This will use a <PolicyLink>cookie</PolicyLink>.",
|
||||||
|
|
|
@ -82,14 +82,36 @@ export default class HTMLExporter extends Exporter {
|
||||||
creatorName,
|
creatorName,
|
||||||
});
|
});
|
||||||
|
|
||||||
const exportedText = _t(`This is the start of export of <b>%(roomName)s</b>.
|
const exportedText = renderToStaticMarkup(
|
||||||
Exported by %(exporterDetails)s at %(exportDate)s. `, {
|
<p>
|
||||||
exportDate,
|
{_t(
|
||||||
roomName: this.room.name,
|
"This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.",
|
||||||
exporterDetails: `<a href="https://matrix.to/#/${exporter}" target="_blank" rel="noopener noreferrer">
|
{
|
||||||
${exporterName ? `<b>${ exporterName }</b>(${ exporter })` : `<b>${ exporter }</b>`}
|
exportDate,
|
||||||
</a>`,
|
},
|
||||||
});
|
{
|
||||||
|
roomName: () => <b>{this.room.name}</b>,
|
||||||
|
exporterDetails: () => (
|
||||||
|
<a
|
||||||
|
href={`https://matrix.to/#/${exporter}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{exporterName ? (
|
||||||
|
<>
|
||||||
|
<b>{exporterName}</b>
|
||||||
|
{exporter}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<b>{exporter}</b>
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</p>,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
const topicText = topic ? _t("Topic: %(topic)s", { topic }) : "";
|
const topicText = topic ? _t("Topic: %(topic)s", { topic }) : "";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue