Skip to content

Commit

Permalink
Merge pull request #3508 from LiteFarmOrg/patch/translations
Browse files Browse the repository at this point in the history
Patch/3.6.8
  • Loading branch information
kathyavini authored Oct 24, 2024
2 parents 191024b + 22adeb8 commit b1b7843
Show file tree
Hide file tree
Showing 142 changed files with 9,169 additions and 2,485 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/automated_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ on:
pull_request:
branches:
- integration
- "patch/**"

jobs:
automated_tests:
runs-on: ubuntu-20.04
container: node:16.15.0
container: node:18.16.1
services:
postgres:
image: postgres:13
Expand Down
3 changes: 2 additions & 1 deletion packages/api/babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
],
"plugins": [
"transform-es2015-modules-commonjs",
"babel-plugin-transform-import-meta"
"babel-plugin-transform-import-meta",
"@babel/plugin-syntax-import-assertions"
]
}
6,454 changes: 5,956 additions & 498 deletions packages/api/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "litefarm-api",
"version": "3.6.7",
"version": "3.6.8",
"description": "LiteFarm API server",
"main": "./api/src/server.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/controllers/managementPlanController.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const managementPlanController = {
const managementPlanGraph = await ManagementPlanModel.query(trx)
.where('management_plan_id', management_plan_id)
.withGraphFetched(
'crop_management_plan.[planting_management_plans.[managementTasks.[task.[pest_control_task, irrigation_task, scouting_task, soil_task, soil_amendment_task, soil_amendment_task_products.[purpose_relationships], field_work_task, harvest_task, cleaning_task, locationTasks]], plant_task.[task.[locationTasks]], transplant_task.[task.[locationTasks]], bed_method, container_method, broadcast_method, row_method]]',
'crop_management_plan.[planting_management_plans.[managementTasks.[task.[pest_control_task, irrigation_task, scouting_task, soil_task, soil_amendment_task, soil_amendment_task_products(filterDeleted).[purpose_relationships], field_work_task, harvest_task, cleaning_task, locationTasks]], plant_task.[task.[locationTasks]], transplant_task.[task.[locationTasks]], bed_method, container_method, broadcast_method, row_method]]',
)
.modifyGraph(
'crop_management_plan.[planting_management_plans.managementTasks]',
Expand Down
16 changes: 11 additions & 5 deletions packages/api/src/controllers/sensorController.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ import knex from '../util/knex.js';
const getSensorTranslations = async (language) => {
// Remove country identifier from language preference
const parsedLanguage = language.includes('-') ? language.split('-')[0] : language;
let translations = await import(`../../../shared/locales/${parsedLanguage}/sensorCSV.json`, {
assert: { type: 'json' },
});
// Default to english in case where user language not supported
if (!translations) {
let translations;
try {
translations = await import(`../../../shared/locales/${parsedLanguage}/sensorCSV.json`, {
assert: { type: 'json' },
});
// Default to english in case where user language not supported
if (!translations) {
throw 'Translations not found';
}
} catch (error) {
console.log(error);
translations = await import(`../../../shared/locales/en/sensorCSV.json`, {
assert: { type: 'json' },
});
Expand Down
9 changes: 1 addition & 8 deletions packages/api/src/jobs/locales/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ import Backend from 'i18next-fs-backend';
i18n.use(Backend).init(
{
fallbackLng: 'en',
preload: [
'en',
'es',
'pt',
'fr',
'de',
// 'hi', 'pa', 'ml'
],
preload: ['en', 'es', 'pt', 'fr', 'de', 'hi', 'pa', 'ml'],
ns: ['translation', 'crop'],
defaultNS: 'translation',
nsSeparator: ':',
Expand Down
9 changes: 1 addition & 8 deletions packages/api/src/jobs/locales/i18next-parser.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,5 @@ export default {
output: 'src/jobs/locales/$LOCALE/$NAMESPACE.json',
sort: true,
defaultValue: 'MISSING',
locales: [
'en',
'es',
'pt',
'fr',
'de',
// 'hi', 'pa', 'ml'
],
locales: ['en', 'es', 'pt', 'fr', 'de', 'hi', 'pa', 'ml'],
};
Binary file added packages/api/src/jobs/locales/ml/readme.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/api/src/jobs/locales/ml/translation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"EXPORT_README_TITLE": "നിങ്ങളുടെ സർട്ടിഫിക്കേഷൻ എക്സ്പോർറ്റ് മനസ്സിലാക്കുന്നു",
"EXPORT_README_TITLE": "നിങ്ങളുടെ സർട്ടിഫിക്കേഷൻ എക്സ്‌പോർട്ട് മനസ്സിലാക്കുന്നു",
"N": "ഇല്ല",
"N/A": "ബാധകമല്ല",
"NO": "ഇല്ല",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (process.env.SENTRY_DSN && environment !== 'development') {
// Automatically instrument Node.js libraries and frameworks
...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
],
release: '3.6.7',
release: '3.6.8',
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
Expand Down
124 changes: 63 additions & 61 deletions packages/api/src/templates/emails/style.css
Original file line number Diff line number Diff line change
@@ -1,106 +1,108 @@
.background {
font-family: "Open Sans", "SansSerif", sans-serif !important;
background: #FAFAFD !important;
margin: 0 !important;
padding-bottom: 34px !important;
font-family: 'Open Sans', 'SansSerif', sans-serif, 'Manjari' !important;
background: #fafafd !important;
margin: 0 !important;
padding-bottom: 34px !important;
}

.header {
background: #C7EFD3 !important;
background: #c7efd3 !important;
}

#logo {
height: 48px !important;
display: block !important;
margin: auto !important;
padding: 0px 28px !important;
background: white !important;
height: 48px !important;
display: block !important;
margin: auto !important;
padding: 0px 28px !important;
background: white !important;
}

.main-container {
background: white !important;
margin: auto !important;
width: 95% !important;
max-width: 568px !important;
border-bottom: 4px solid #C7EFD3 !important;
background: white !important;
margin: auto !important;
width: 95% !important;
max-width: 568px !important;
border-bottom: 4px solid #c7efd3 !important;
}

.main-content {
padding: 2vw 4vw !important;
padding: 2vw 4vw !important;
}

.main-content p {
font-style: normal !important;
font-weight: normal !important;
font-size: 16px !important;
line-height: 24px !important;
color: #262422 !important;
font-style: normal !important;
font-weight: normal !important;
font-size: 16px !important;
line-height: 24px !important;
color: #262422 !important;
}

.support-header {
font-weight: 600 !important;
font-style: normal !important;
font-size: 16px !important;
line-height: 24px !important;
color: #262422 !important;
font-weight: 600 !important;
font-style: normal !important;
font-size: 16px !important;
line-height: 24px !important;
color: #262422 !important;
}

.support-content {
font-style: normal !important;
font-weight: normal !important;
font-size: 16px !important;
line-height: 24px !important;
color: #262422 !important;
font-style: normal !important;
font-weight: normal !important;
font-size: 16px !important;
line-height: 24px !important;
color: #262422 !important;
}

.support-container {
margin: 36px 0 !important;
margin: 36px 0 !important;
}

.button-aligner {
text-align: center !important;
text-align: center !important;
}

.button {
text-decoration: none !important;
color: #282B36 !important;
background: #FCE38D !important;
border-radius: 4px !important;
padding: 12px 12px !important;
width: 90% !important;
max-width: 248px !important;
cursor: pointer !important;
border: none !important;
box-shadow: 0px 2px 8px rgba(102, 115, 138, 0.3) !important;
font-style: normal !important;
font-weight: 600 !important;
font-size: 16px !important;
line-height: 24px !important;
text-decoration: none !important;
color: #282b36 !important;
background: #fce38d !important;
border-radius: 4px !important;
padding: 12px 12px !important;
width: 90% !important;
max-width: 248px !important;
cursor: pointer !important;
border: none !important;
box-shadow: 0px 2px 8px rgba(102, 115, 138, 0.3) !important;
font-style: normal !important;
font-weight: 600 !important;
font-size: 16px !important;
line-height: 24px !important;
}

p {
font-size: 20px !important;
font-size: 20px !important;
}

.footer {
text-align: center !important;
margin-top: 34px !important;
text-align: center !important;
margin-top: 34px !important;
}

.footer p {
font-style: normal !important;
font-weight: normal !important;
font-size: 12px !important;
line-height: 24px !important;
color: #9FAABE !important;
font-style: normal !important;
font-weight: normal !important;
font-size: 12px !important;
line-height: 24px !important;
color: #9faabe !important;
}

.main-content p a, .footer a {
color: #38AA92 !important;
text-decoration: none !important;
.main-content p a,
.footer a {
color: #38aa92 !important;
text-decoration: none !important;
}

.main-content p a:hover, .footer a:hover {
color: #38AA92 !important;
text-decoration: underline !important;
.main-content p a:hover,
.footer a:hover {
color: #38aa92 !important;
text-decoration: underline !important;
}
5 changes: 2 additions & 3 deletions packages/api/src/templates/locales/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
"PRIVACY": "ലൈറ്റ്ഫാമിൽ, ഞങ്ങൾ നിങ്ങളുടെ സ്വകാര്യത ഗൗരവമായി കാണുന്നു, അതിനാൽ നിങ്ങളുടെ എക്സ്പോർറ്റ് ആക്‌സസ് ചെയ്യുന്നതിന് മുമ്പ് നിങ്ങൾ ലോഗിൻ ചെയ്യേണ്ടതുണ്ട്. എന്തെങ്കിലും അസൗകര്യം ഉണ്ടായതിൽ ഖേദിക്കുന്നു. നിങ്ങളുടെ സമർപ്പണത്തിന് ആശംസകൾ, ലൈറ്റ്ഫാം ഉപയോഗിച്ചതിന് നന്ദി!",
"SUBJECT": "ലൈറ്റ്ഫാമിൽ നിന്ന് നിങ്ങളുടെ സർട്ടിഫിക്കേഷൻ രേഖകൾ എക്സ്പോർറ്റ് ചെയ്യുന്നു",
"HI": "നമസ്തേ",
"GET_YOUR_EXPORT": "രേഖകൾ നേടുക",
"LANGUAGE_DELAY": ""
"GET_YOUR_EXPORT": "രേഖകൾ നേടുക"
},
"COMMON": {
"JOIN": "ചേരുക",
Expand All @@ -102,4 +101,4 @@
"WORKER": "തൊഴിലാളി",
"EXTENSION_OFFICER": "എക്സ്റ്റൻഷൻ ഓഫീസർ"
}
}
}
9 changes: 1 addition & 8 deletions packages/api/src/templates/sendEmailTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,7 @@ const emailTransporter = new EmailTemplates({
root: path.join(dir, 'emails'),
},
i18n: {
locales: [
'en',
'es',
'fr',
'pt',
'de',
// 'hi', 'pa', 'ml'
],
locales: ['en', 'es', 'fr', 'pt', 'de', 'hi', 'pa', 'ml'],
directory: path.join(dir, 'locales'),
objectNotation: true,
},
Expand Down
17 changes: 17 additions & 0 deletions packages/shared/locales/hi/sensorCSV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"CSV_HEADER_TRANSLATIONS": {
"name": "नाम",
"latitude": "अक्षांश",
"longitude": "देशांतर",
"reading_types": "पठन_प्रकार",
"external_id": "बाह्य_ID",
"depth": "गहराई_सेमी",
"brand": "ब्रांड",
"model": "मॉडल"
},
"READING_TYPE_TRANSLATIONS": {
"soil_water_content": "मृदा_जल_सामग्री",
"soil_water_potential": "मृदा_जल_क्षमता",
"temperature": "तापमान"
}
}
17 changes: 17 additions & 0 deletions packages/shared/locales/ml/sensorCSV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"CSV_HEADER_TRANSLATIONS": {
"name": "പേര്",
"latitude": "അക്ഷാംശം",
"longitude": "രേഖാംശം",
"reading_types": "വായന_തരങ്ങൾ",
"external_id": "ബാഹ്യ_ഐഡി",
"depth": "ആഴം_സെ.മീ",
"brand": "ബ്രാൻഡ്",
"model": "മോഡൽ"
},
"READING_TYPE_TRANSLATIONS": {
"soil_water_content": "മണ്ണ്_ജലം_ഉള്ളടക്കം",
"soil_water_potential": "മണ്ണ്_ജലം_ ശേഷി",
"temperature": "താപനില"
}
}
17 changes: 17 additions & 0 deletions packages/shared/locales/pa/sensorCSV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"CSV_HEADER_TRANSLATIONS": {
"name": "ਨਾਮ",
"latitude": "ਵਿਥਕਾਰ",
"longitude": "ਲੰਬਕਾਰ",
"reading_types": "ਪੜ੍ਹਨਾ_ਕਿਸਮਾਂ",
"external_id": "ਬਾਹਰੀ_ID",
"depth": "ਡੂੰਘਾਈ_ਸੈ.ਮੀ",
"brand": "ਬ੍ਰਾਂਡ",
"model": "ਮਾਡਲ"
},
"READING_TYPE_TRANSLATIONS": {
"soil_water_content": "ਮਿੱਟੀ_ਪਾਣੀ_ਸਮੱਗਰੀ",
"soil_water_potential": "ਮਿੱਟੀ_ਪਾਣੀ_ਸੰਭਾਵੀ",
"temperature": "ਤਾਪਮਾਨ"
}
}
Loading

0 comments on commit b1b7843

Please sign in to comment.