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

Translation fixes #92

Merged
merged 5 commits into from
Dec 11, 2020
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 gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.0.26-SNAPSHOT
VERSION_NAME=1.0.27-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client CHW Family Planning Library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void setProfileViewDetails(FpMemberObject fpMemberObject) {
int age = new Period(new DateTime(fpMemberObject.getAge()), new DateTime()).getYears();
tvName.setText(String.format(Locale.getDefault(), "%s %s %s, %d", fpMemberObject.getFirstName(),
fpMemberObject.getMiddleName(), fpMemberObject.getLastName(), age));
tvGender.setText(fpMemberObject.getGender());
tvGender.setText(FpUtil.getGenderTranslated(this, fpMemberObject.getGender()));
tvLocation.setText(fpMemberObject.getAddress());
tvUniqueID.setText(fpMemberObject.getUniqueId());
imageRenderHelper.refreshProfileImage(fpMemberObject.getBaseEntityId(), profileImageView, FpUtil.getMemberProfileImageResourceIDentifier());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ private void populatePatientColumn(CommonPersonObjectClient pc, final RegisterVi
int age = new Period(new DateTime(dobString), new DateTime()).getYears();

String patientName = getName(firstName, Utils.getValue(pc.getColumnmaps(), FamilyPlanningConstants.DBConstants.LAST_NAME, true));
String methodAccepted = FpUtil.getTranslatedMethodValue(FamilyPlanningConstants.DBConstants.FP_METHOD_ACCEPTED, context);
String methodAccepted = Utils.getValue(pc.getColumnmaps(), FamilyPlanningConstants.DBConstants.FP_METHOD_ACCEPTED, true);
viewHolder.patientName.setText(patientName + ", " + age);
viewHolder.textViewFpMethod.setText(Utils.getValue(pc.getColumnmaps(), methodAccepted, true));
viewHolder.textViewFpMethod.setText(FpUtil.getTranslatedMethodValue(methodAccepted, context));
viewHolder.textViewVillage.setText(Utils.getValue(pc.getColumnmaps(), FamilyPlanningConstants.DBConstants.VILLAGE_TOWN, true));
viewHolder.patientColumn.setOnClickListener(onClickListener);
viewHolder.patientColumn.setTag(pc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;
import org.opensrp.api.constants.Gender;
import org.smartregister.chw.fp.FpLibrary;
import org.smartregister.chw.fp.contract.BaseFpCallDialogContract;
import org.smartregister.chw.fp.dao.FpDao;
Expand Down Expand Up @@ -153,33 +154,43 @@ public static void processChangeFpMethod(String baseEntityId) {

public static String getTranslatedMethodValue(@Nullable String fpMethod, Context context){
if(fpMethod != null){
fpMethod = fpMethod.toLowerCase();
switch (fpMethod){
case "COC":
case "cdc":
return context.getString(R.string.coc);
case "POP":
case "pop":
return context.getString(R.string.pop);
case "Female sterilization":
case "female sterilization":
return context.getString(R.string.female_sterilization);
case "Injectable":
case "injectable":
return context.getString(R.string.injectable);
case "Male condom":
case "male condom":
return context.getString(R.string.male_condom);
case "Female condom":
case "female condom":
return context.getString(R.string.female_condom);
case "IUCD":
case "iucd":
return context.getString(R.string.iucd);
case "Implanon - NXT":
case "implanon - nxt":
return context.getString(R.string.implanon);
case "Male sterilization":
case "male sterilization":
return context.getString(R.string.male_sterilization);
case "Jadelle":
case "jadelle":
return context.getString(R.string.jadelle);
case "Standard day method":
case "standard day method":
return context.getString(R.string.standard_day_method);
default:
return fpMethod;
}
}
return fpMethod;
}

public static String getGenderTranslated(Context context, String gender) {
if (gender.equalsIgnoreCase(Gender.MALE.toString())) {
return context.getResources().getString(R.string.male);
} else if (gender.equalsIgnoreCase(Gender.FEMALE.toString())) {
return context.getResources().getString(R.string.female);
}
return "";
}
}
52 changes: 27 additions & 25 deletions opensrp-chw-family-planning/src/main/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<resources>
<string name="app_name">Uzazi wa mpango</string>
<string name="app_name">Uzazi wa Mpango</string>
<string name="scan_qr">Scan QR</string>
<string name="home">Nyumbani</string>
<string name="add_family">Ongeza Mwanafamilia</string>
<string name="job_aids">Viendea kazi</string>
<string name="error_unable_to_start_form">Hitilafu wakati wa kuanza form</string>
<string name="fp_return_to_previous_page">Rudi kwa wateja wote wa uzazi wa mpango</string>
<string name="add_family">Sajili Kaya</string>
<string name="job_aids">Vitendea kazi</string>
<string name="error_unable_to_start_form">Hitilafu wakati wa kuanza fomu</string>
<string name="fp_return_to_previous_page">Rudi kwenye wateja wote wa uzazi wa mpango</string>
<string name="family_head">MKUU WA KAYA</string>
<string name="primary_care_giver">Mlezi</string>
<string name="record_fp_followup">Rekodi tembeleo la ufuatiliaji wa uzazi wa mpango</string>
<string name="fp_visit_done">Tembeleo la ufuatiliaji wa uzazi wa mpango limefanyika</string>
<string name="fp_visit_done">Tembeleo la ufuatiliaji wa uzazi wa mpango limekamilka</string>
<string name="not_visiting_this_month">Tembeleo halifanyiki mwezi huu</string>
<string name="last_visit">Tembeleo la mwisho</string>
<string name="last_visit_n_days_ago">Tembeleo la mwisho %1$s iliyopita</string>
<string name="less_than_twenty_four">chini ya masaa 24</string>
<string name="days">Siku</string>
<string name="days">siku</string>
<string name="fp_visit_edit">Hariri</string>
<string name="view_fp_registration">Angalia usajili wa Uzazi wa Mpango</string>
<string name="view_medical_history">Angalia historia ya matitbabu</string>
<string name="view_upcoming_services">Huduma zinazofuata</string>
<string name="view_medical_history">Angalia historia ya huduma</string>
<string name="view_upcoming_services">Angalia huduma zinazokaribia</string>
<string name="family_has_nothing_due">Hakuna huduma iliyofika muda wake kwenye kaya</string>
<string name="family_has_services_due">Huduma zimefikia muda wake kwenye kaya</string>
<string name="fp_service_upcoming"><![CDATA[%1$s <font color=#7f7f7f> inayofuata (%2$s)</font></b>]]></string>
<string name="fp_service_overdue"><![CDATA[%1$s <font color=#f04646>iliyopitiliza muda (%2$s)</font></b>]]> </string>
<string name="fp_service_due"><![CDATA[%1$s <font color=#000000>imefika (%2$s)</font> </b>]]></string>
<string name="family_has_service_overdue"><![CDATA[Kaya ina <font color=#FF0000>huduma zilizopitiliza muda wake</font></b>]]></string>
<string name="go_to_family_s_profile">Elekea kwenye taarifa binafsi za kaya</string>
<string name="go_to_family_s_profile">Elekea kwenye taarifa za kaya</string>
<string name="error_unable_to_save_form">Hitilafu wakati wa kuhifadhi fomu</string>
<string name="fp_followup_visit">Tembeleo la\nufuatiliaji</string>
<string name="fp_followup_visit">Tembeleo la\nUfuatiliaji</string>
<string name="sort">Panga</string>
<string name="family_planning">Uzazi wa mpango</string>
<string name="saving_dialog_title">Inahifadhi</string>
Expand All @@ -42,22 +42,22 @@
<!--FP -->
<string name="fp_visit_day_next_due">Inayofuata kufika mda %s</string>
<string name="fp_visit_day_due">%s Siku zimefika mda wake</string>
<string name="fp_visit_day_due_today">Imefika leo</string>
<string name="fp_visit_day_overdue">%s siku zimepita</string>
<string name="fp_visit_day_overdue_today">Imepita leo</string>
<string name="fp_visit_day_due_today">UMEFIKA LEO</string>
<string name="fp_visit_day_overdue">%s SIKU ZIMEPITA</string>
<string name="fp_visit_day_overdue_today">UMEPITA LEO</string>
<string name="fp_follow_up_visit">Tembeleo la ufuatiliaji wa uzazi wa mpango</string>
<string name="fp_side_effects">Madhara</string>
<string name="counseling">Ushauri</string>
<string name="resupply">Sambaza upya %s</string>
<string name="next_health_facility_visit">Hudhurio linalofuatala la kituoni</string>
<string name="next_health_facility_visit">Hudhurio linalofuata</string>
<string name="no_of_condoms">Idadi ya kondomu</string>
<string name="no_of_pill_cycles">Namba ya mzunguko wa vidonge:</string>
<string name="date_of_next_injection">Tarehe inayofuata ya sindano:</string>
<string name="side_effects">Madhara:</string>
<string name="action">Shughuli:</string>
<string name="action">Hatua:</string>
<!--counselling -->
<string name="yes">Ndiyo</string>
<string name="no">Hapana</string>
<string name="yes">ndiyo</string>
<string name="no">hapana</string>
<!-- side effects -->
<string name="allergic_reactions">Matokeo ya aleji</string>
<string name="heavy_bleading">Kuvuja damu nyingi</string>
Expand All @@ -70,11 +70,11 @@
<string name="heavier_period">Hedhi nzito na mkakamao mkali wa misuli wakati wa hedhi</string>
<string name="IUCD_explusion">Kutoa kitanzi</string>
<string name="incisional_bleeding">Kutoka damu kwenye upasuaji</string>
<string name="pus_discharge_from_incision">Pus/Kutoka kwa majimaji kwenye upasuaji</string>
<string name="pus_discharge_from_incision">Kutoka kwa majimaji kwenye upasuaji</string>
<string name="swollen_around_the_incision">Kuvimba kwenye upasuaji</string>
<!--action taken -->
<string name="managed">Imesimamiwa</string>
<string name="Referred">Rufaa imetolewa</string>
<string name="managed">Amepata huduma</string>
<string name="Referred">Amepewa rufaa </string>

<!--Family planning fp start dates row-->
<string name="male_condom">Kondomu ya kiume</string>
Expand All @@ -89,13 +89,15 @@
<string name="iucd">Kitanzi</string>
<string name="standard_day_method">Njia ya kalenda</string>
<string name="emergency_contraceptive">Vidonge nya dharura</string>
<string name="not_applicable">Sio husika</string>
<string name="not_applicable">haiusiki</string>
<string name="fp_insertion">Vipandikizi</string>
<string name="fp_started">Imeanza</string>
<string name="fp_on">Imewashwa</string>

<string name="refill">{0} jaza tena</string>
<string name="follow_up_one">{0} ufuatiliaji 1</string>
<string name="follow_up_two">{0} ufuatiliaji 2</string>
<string name="follow_up_three">{0} ufuatiliaji 3</string>
<string name="follow_up_one">{0} ufuatiliaji wa 1</string>
<string name="follow_up_two">{0} ufuatiliaji wa 2</string>
<string name="follow_up_three">{0} ufuatiliaji wa 3</string>
<string name="male">Me</string>
<string name="female">Ke</string>
</resources>
2 changes: 2 additions & 0 deletions opensrp-chw-family-planning/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@
<string name="follow_up_one">{0} follow-up 1</string>
<string name="follow_up_two">{0} follow-up 2</string>
<string name="follow_up_three">{0} follow-up 3</string>
<string name="male">Male</string>
<string name="female">Female</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.smartregister.chw.fp.util;

import android.content.Context;
import android.content.res.Resources;

import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.smartregister.fp.R;

public class FpUtilTest {


@Test
public void testGetGender() {
Context context = Mockito.mock(Context.class);
Resources resources = Mockito.mock(Resources.class);
//
Mockito.doReturn(resources).when(context).getResources();
Mockito.doReturn("Male").when(resources).getString(R.string.male);
Mockito.doReturn("Female").when(resources).getString(R.string.female);

Assert.assertEquals("Male", FpUtil.getGenderTranslated(context, "male"));
Assert.assertEquals("Female", FpUtil.getGenderTranslated(context, "female"));
}

}