Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1011 Non-localized stablecoin type #1025

Merged
merged 3 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/web/components/complex/add-liquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ export const AddLiquidity: FunctionComponent<
textClassName="w-full text-center"
message={t("addLiquidity.stablecoinWarning", {
denom: currency!.originCurrency!.coinDenom,
mechanism: currency.originCurrency!.pegMechanism!,
mechanism: t(
`stablecoinTypes.${currency.originCurrency!
.pegMechanism!}`
),
})}
/>
)}
Expand Down
63 changes: 43 additions & 20 deletions packages/web/localizations/dayjs-locale-es.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
!(function (e, n) {
"object" == typeof exports && "undefined" != typeof module
? (module.exports = n())
: "function" == typeof define && define.amd
? define(n)
: ((e =
"undefined" != typeof globalThis
? globalThis
: e || self).dayjs_locale_en = n());
})(this, function () {
"use strict";
return {
name: "es",
weekdays: "Domingo_Lunes_Martes_Jueves_Viernes_Sabado_Domingo".split("_"),
months:
"Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Augosto_Septiembre_Octubre_Noviembre_Diciembre".split(
"_"
),
};
});
// Spanish [es]
import dayjs from "dayjs";

const locale = {
name: "es",
monthsShort: "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),
weekdays: "domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),
weekdaysShort: "dom._lun._mar._mié._jue._vie._sáb.".split("_"),
weekdaysMin: "do_lu_ma_mi_ju_vi_sá".split("_"),
months:
"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split(
"_"
),
weekStart: 1,
formats: {
LT: "H:mm",
LTS: "H:mm:ss",
L: "DD/MM/YYYY",
LL: "D [de] MMMM [de] YYYY",
LLL: "D [de] MMMM [de] YYYY H:mm",
LLLL: "dddd, D [de] MMMM [de] YYYY H:mm",
},
relativeTime: {
future: "en %s",
past: "hace %s",
s: "unos segundos",
m: "un minuto",
mm: "%d minutos",
h: "una hora",
hh: "%d horas",
d: "un día",
dd: "%d días",
M: "un mes",
MM: "%d meses",
y: "un año",
yy: "%d años",
},
ordinal: (n) => `${n}º`,
};

dayjs.locale(locale, null, true);

export default locale;
61 changes: 44 additions & 17 deletions packages/web/localizations/dayjs-locale-ko.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
!(function (e, n) {
"object" == typeof exports && "undefined" != typeof module
? (module.exports = n())
: "function" == typeof define && define.amd
? define(n)
: ((e =
"undefined" != typeof globalThis
? globalThis
: e || self).dayjs_locale_en = n());
})(this, function () {
"use strict";
return {
name: "ko",
weekdays: "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),
months: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
};
});
// Korean [ko]
import dayjs from "dayjs";

const locale = {
name: "ko",
weekdays: "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),
weekdaysShort: "일_월_화_수_목_금_토".split("_"),
weekdaysMin: "일_월_화_수_목_금_토".split("_"),
months: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
monthsShort: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
ordinal: (n) => n,
formats: {
LT: "A h:mm",
LTS: "A h:mm:ss",
L: "YYYY.MM.DD.",
LL: "YYYY년 MMMM D일",
LLL: "YYYY년 MMMM D일 A h:mm",
LLLL: "YYYY년 MMMM D일 dddd A h:mm",
l: "YYYY.MM.DD.",
ll: "YYYY년 MMMM D일",
lll: "YYYY년 MMMM D일 A h:mm",
llll: "YYYY년 MMMM D일 dddd A h:mm",
},
meridiem: (hour) => (hour < 12 ? "오전" : "오후"),
relativeTime: {
future: "%s 후",
past: "%s 전",
s: "몇 초",
m: "1분",
mm: "%d분",
h: "한 시간",
hh: "%d시간",
d: "하루",
dd: "%d일",
M: "한 달",
MM: "%d달",
y: "일 년",
yy: "%d년",
},
};

dayjs.locale(locale, null, true);

export default locale;
5 changes: 4 additions & 1 deletion packages/web/localizations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,8 @@
"Amount is empty": "La cantidad está vacía",
"Insufficient amount": "Cantidad insuficiente",
"Amount is zero": "La cantidad es cero",
"Minimum of 2 assets required": "Mínimo de 2 activos requeridos"
"Minimum of 2 assets required": "Mínimo de 2 activos requeridos",
"stablecoinTypes": {
"collateralized": "colateralizado"
}
}
2 changes: 1 addition & 1 deletion packages/web/modals/keplr-connection-selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const KeplrConnectionSelectModal: FunctionComponent<
/>
<div className="flex flex-col text-left ml-5">
<div className="flex items-center gap-2">
<h6>{t("installKeplr")}</h6>
<h6>{t("keplr.install")}</h6>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

<Image
src="/icons/external-link-white.svg"
alt="external link"
Expand Down
6 changes: 6 additions & 0 deletions packages/web/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { OgpMeta } from "../components/ogp-meta";
import { MainLayoutMenu } from "../components/types";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
import updateLocale from "dayjs/plugin/updateLocale";
import relativeTime from "dayjs/plugin/relativeTime";
import utc from "dayjs/plugin/utc";
import { GetKeplrProvider } from "../hooks";
Expand All @@ -32,10 +33,15 @@ import {

import en from "../localizations/en.json";
import { Formatted } from "../components/localization";
import dayjsLocaleEs from "../localizations/dayjs-locale-es.js";
import dayjsLocaleKo from "../localizations/dayjs-locale-ko.js";

dayjs.extend(relativeTime);
dayjs.extend(duration);
dayjs.extend(utc);
dayjs.extend(updateLocale);
dayjs.updateLocale("es", dayjsLocaleEs);
dayjs.updateLocale("ko", dayjsLocaleKo);
enableStaticRendering(typeof window === "undefined");

const DEFAULT_LANGUAGE = "en";
Expand Down