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

HOTFIX: change catalan locale & route to ct from ca #4988

Merged
merged 1 commit into from
Jan 30, 2025
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
2 changes: 1 addition & 1 deletion lang/ca.json → lang/ct.json
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@
"label.you_supported_this_project_with_100%": "Has donat suport a aquest projecte amb el 100% del teu GIVpower total. No pots editar la distribució a menys que tinguis com a mínim un altre projecte impulsat. Prova de boostejar altres projectes o gestionar-los a",
"label.you_will_donate_total": "Donaràs un total de",
"label.zero_gas_fees_straight_to_your_wallet": "Zero tarifes de gas, directe a la teva billetera",
"lang.ca": "Català",
"lang.ct": "Català",
"lang.en": "Inglés",
"lang.es": "Español",
"mental-health": "Salut Mental",
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@
"label.you_supported_this_project_with_100%": "You supported this project with 100% of your total GIVpower. You can't edit the allocation unless you have at least 1 other boosted project. Try boosting other projects or managing them in",
"label.you_will_donate_total": "You will donate a total of",
"label.zero_gas_fees_straight_to_your_wallet": "Zero Gas Fees, Straight To Your Wallet",
"lang.ca": "Catalan",
"lang.ct": "Catalan",
"lang.en": "English",
"lang.es": "Spanish",
"mental-health": "Mental Health",
Expand Down
2 changes: 1 addition & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@
"label.you_supported_this_project_with_100%": "Has apoyado este proyecto con el 100% de tu GIVpower total. No puedes editar la asignación a menos que tengas al menos otro proyecto boosteado. Intenta boostear otros proyectos o gestionarlos en",
"label.you_will_donate_total": "Donarás un total de",
"label.zero_gas_fees_straight_to_your_wallet": "Cero Tarifas de Gas, Directo a tu Billetera",
"lang.ca": "Catalán",
"lang.ct": "Catalán",
"lang.en": "Inglés",
"lang.es": "Español",
"mental-health": "Salud Mental",
Expand Down
8 changes: 4 additions & 4 deletions lang/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const en = JSON.parse(enJsonData);
const esJsonData = fs.readFileSync('es.json');
const es = JSON.parse(esJsonData);

const caJsonData = fs.readFileSync('ca.json');
const ca = JSON.parse(caJsonData);
const ctJsonData = fs.readFileSync('ct.json');
const ct = JSON.parse(ctJsonData);

function findSameKeyValue(obj) {
const sameKeyValue = {};
Expand All @@ -28,7 +28,7 @@ function save(obj, name) {
}

const ntEs = findSameKeyValue(es);
const ntCa = findSameKeyValue(ca);
const ntCt = findSameKeyValue(ct);

save(ntEs, 'nt_es.json');
save(ntCa, 'nt_ca.json');
save(ntCt, 'nt_ca.json');
4 changes: 2 additions & 2 deletions lang/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ca from './ca.json';
import ct from './ct.json';
import en from './en.json';
import es from './es.json';

export { ca, en, es };
export { ct, en, es };
18 changes: 9 additions & 9 deletions lang/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ async function FillSpanishJsonFile() {
const esJsonData = fs.readFileSync('es.json');
const es = JSON.parse(esJsonData);

// const caJsonData = fs.readFileSync('ca.json');
// const ca = JSON.parse(caJsonData);
// const ctJsonData = fs.readFileSync('ca.json');
// const ca = JSON.parse(ctJsonData);

for (const key in es) {
if (Object.hasOwnProperty.call(es, key)) {
Expand All @@ -68,20 +68,20 @@ async function FillCatalanJsonFile() {
const enJsonData = fs.readFileSync('en.json');
const en = JSON.parse(enJsonData);

const caJsonData = fs.readFileSync('ca.json');
const ca = JSON.parse(caJsonData);
const ctJsonData = fs.readFileSync('ct.json');
const ct = JSON.parse(ctJsonData);

for (const key in ca) {
if (Object.hasOwnProperty.call(ca, key)) {
const value = ca[key];
for (const key in ct) {
if (Object.hasOwnProperty.call(ct, key)) {
const value = ct[key];
if (value === '') {
console.log(key, en[key]);
ca[key] = await translate(en[key], 'Catalan');
ct[key] = await translate(en[key], 'Catalan');
}
}
}

save(ca, 'ca.json');
save(ct, 'ct.json');
}

FillSpanishJsonFile();
Expand Down
14 changes: 7 additions & 7 deletions lang/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const en = JSON.parse(enJsonData);
const esJsonData = fs.readFileSync('es.json');
const es = JSON.parse(esJsonData);

const caJsonData = fs.readFileSync('ca.json');
const ca = JSON.parse(caJsonData);
const ctJsonData = fs.readFileSync('ct.json');
const ct = JSON.parse(ctJsonData);

function sort(data) {
// Convert object to array of key-value pairs
Expand Down Expand Up @@ -72,18 +72,18 @@ function removeExtraKeys(obj) {
}

const filteredEs = removeExtraKeys(es);
const filteredCa = removeExtraKeys(ca);
const filteredCt = removeExtraKeys(ct);

const updatedEs = addMissingKeys(filteredEs);
const updatedCa = addMissingKeys(filteredCa);
const updatedCt = addMissingKeys(filteredCt);

const sortedEn = sort(en);
const sortedEs = sort(updatedEs);
const sortedCa = sort(updatedCa);
const sortedCt = sort(updatedCt);

const filledEs = fillEmptyValues(sortedEs);
const filledCa = fillEmptyValues(sortedCa);
const filledCt = fillEmptyValues(sortedCt);

save(sortedEn, 'en.json');
save(filledEs, 'es.json');
save(filledCa, 'ca.json');
save(filledCt, 'ct.json');
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
const generateRobotsTxt = require('./scripts/generate-robots-txt');

const defaultLocale = 'en';
const locales = ['en', 'ca', 'es'];
const locales = ['en', 'ct', 'es'];

const moduleExports = withBundleAnalyzer({
// Your existing module.exports
Expand Down
4 changes: 2 additions & 2 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { HeaderWrapper } from '@/components/Header/HeaderWrapper';
import { FooterWrapper } from '@/components/Footer/FooterWrapper';
import '../styles/globals.css';
import { ca, en, es } from '../lang';
import { ct, en, es } from '../lang';
import { store } from '@/features/store';
import SubgraphController from '@/components/controller/subgraph.ctrl';
import UserController from '@/components/controller/user.ctrl';
Expand Down Expand Up @@ -59,7 +59,7 @@
const queryClient = new QueryClient();

export const IntlMessages = {
ca,
ct,
en,
es,
};
Expand Down Expand Up @@ -125,7 +125,7 @@
!isBypassingMaintenance;

useEffect(() => {
const handleStart = (url: string) => {

Check warning on line 128 in pages/_app.tsx

View workflow job for this annotation

GitHub Actions / build

'url' is defined but never used. Allowed unused args must match /^_/u
NProgress.start();
};
const handleChangeComplete = (url: string) => {
Expand Down Expand Up @@ -182,7 +182,7 @@
}
};
asyncFunc();
}, []);

Check warning on line 185 in pages/_app.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has missing dependencies: 'asPath', 'pathname', 'query', and 'router'. Either include them or remove the dependency array

return (
<>
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion src/components/modals/LanguageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IModal } from '@/types/common';
import { useModalAnimation } from '@/hooks/useModalAnimation';
import StorageLabel from '@/lib/localStorage';

const availableLanguages = ['ca', 'en', 'es'];
const availableLanguages = ['ct', 'en', 'es'];

export const LanguageModal: FC<IModal> = ({ setShowModal }) => {
const router = useRouter();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const durationToYMDh = (
const shortRes = { y, m, d, h, min, sec };
if (full) {
let fullRes: any = {};
if (locale === 'ca') {
if (locale === 'ct') {
if (y) fullRes[`any${y > 1 ? 's' : ''}`] = y;
if (m) fullRes[`${m > 1 ? 'mesos' : 'mes'}`] = m;
if (d) fullRes[`${d > 1 ? 'dies' : 'dia'}`] = d;
Expand Down
Loading