← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6063: Added util script for finding unused keys in translation property files. Clean dataset module.

 

------------------------------------------------------------
revno: 6063
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-02-21 12:39:05 +0100
message:
  Added util script for finding unused keys in translation property files. Clean dataset module.
added:
  resources/util/find_unused_keys.sh
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/Jaxb2Utils.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2012-02-21 11:39:05 +0000
@@ -127,9 +127,9 @@
      */
     private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
 
-    /*
-     * Transient fields
-     */
+    // -------------------------------------------------------------------------
+    // Transient fields
+    // -------------------------------------------------------------------------
 
     private transient boolean currentParent;
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/Jaxb2Utils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/Jaxb2Utils.java	2012-02-21 07:42:09 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/Jaxb2Utils.java	2012-02-21 11:39:05 +0000
@@ -52,7 +52,7 @@
     public static void marshal( Object domainModel, OutputStream output )
         throws JAXBException
     {
-        Jaxb2Utils.createMarshaller( domainModel ).marshal( domainModel, output );
+        createMarshaller( domainModel ).marshal( domainModel, output );
     }
     
     public static Unmarshaller createUnmarshaller( Class<?> clazz )
@@ -69,6 +69,6 @@
     public static <T> T unmarshal( Class<?> clazz, InputStream input ) 
         throws JAXBException
     {
-        return (T) Jaxb2Utils.createUnmarshaller( clazz ).unmarshal( input );
+        return (T) createUnmarshaller( clazz ).unmarshal( input );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties	2012-02-05 13:27:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties	2012-02-21 11:39:05 +0000
@@ -1,5 +1,3 @@
-intro_mobile_dataset=Define and sort the data sets which are available for facility reporting on the mobile client.
-mobile_dataset=Dataset for Mobile
 available_for_mobile_reporting=Available for Mobile Reporting
 please_select_dataset=Please select a dataset
 greying_area=Greying area
@@ -7,42 +5,30 @@
 disable=Disable
 enable=Enable
 nr=Nr
-section_layout=Section Layout
 data_element=Data element
 data_elements=Data elements
 indicators=Indicators
 category_combo=Category Combo
 select_categorycombo=Select Category Combo
 title=Title
-manage_greyed_fields=Manage greyed fields
 category_combo=Category combinations
 add_dataset=Add dataset
 dataset_details=Dataset Details
-parent_dataset=Parent Dataset
-routine=Routine
-semi-permanent=Semi-permanent
 frequency=Frequency
 selected_data_elements=Selected data elements
 available_data_elements=Available data elements
 selected_indicators=Selected indicators
 available_indicators=Available indicators
-group_filter=Group filter
 define_associations=Assign dataset to organisation units
 id=Id
 number_of_data_elements=Number of data elements
 define_dataset_associations=Assign dataset to organisation units for registering
 assign=Assign
 edit_dataset=Edit dataset
-update_dataset=Update dataset
-dataset_menu=Dataset menu
-add_new_dataset=Add new dataset
-overview=Overview
-no_orgunit_is_selected=No organisation unit selected
 confirm_delete=Are you sure you want to delete this dataset?
 duplicate_names=This name is already registered
 duplicate_short_names=This short name is already registered
 duplicate_codes=This code is already registered
-illegal_associations=A dataset cannot be assigned to two organisation units where one of them is a direct or indirect parent of the other
 level=Level
 dataentryform=Data entry form
 dataentryform_management=Data entry form management
@@ -50,13 +36,9 @@
 dataentryform_design=Design data entry form
 delete=Delete this form
 dataset=Dataset
-dataentryform_duplicate_names=A data entry form with this name already exists
 dataentryform_confirm_delete=Are you sure you want to delete this data entry form?
 unable_delete=Unable to delete data entry form
 insert=Insert
-dataelement_count_mismatch=Some of the data elements in the dataset are missing from the custom data entry form, do you want to proceed anyway?
-view_as=View as
-no_more_elements_to_select=All data elements have been placed in the form. Deleting data element fields from the form will make them reappear in this popup. Please click Cancel to return to the form.
 select_dataset=Select dataset
 sort_section=Sort section
 dataset_section=Dataset Section
@@ -64,68 +46,27 @@
 group=Group
 add_section=Add section
 section_details=Section Details
-selected_sections=Selected sections
-available_sections=Available sections
-add_dataset_section=Add dataset section
-update_dataset_section=Update dataset section
 edit_section=Edit section
-loading=Loading, please wait...
 sort=Sort
 data_set_sort_order=Data set sort order
 design_data_entry_form=Design data entry form
-view_section_management=View section management
-add_new_custom_value=Add New
-delete_custom_value=Delete
-done_custom_value=Done
-cv_must_be_added=Custom Value Text Must Be Added
-existing_custom_values_for_this_data_element_are_listed=Existing Castom Values for Selected Data Element are Listed
-default_category_selected=Default Category Option is Selected
-duplicates_are_not_allowed=Duplicates are Not Allowed
-first_select_de_and_cc=First Select Data Element and Category Option
-de_must_be_selected_first=Data Element Must be Selected First
-cc_must_be_selected_first=Category Option Must be Selected First
-cv_must_be_selected_first=Custom Value Must be Selected First
-cv_removed=Custom Value Removed
-select_optioncombo=Available Category Options
-available_customvalue=Suggested Custom Values
-manage_custom_values=Manage Custom Value Lists
-edit_custom_values=Edit custom values
-select_customvalue=Selected Custom Values
-selectdataelement=Available Data Elements
 dataset_management=Dataset management
 section_management=Dataset Section management
 intro_dataset=Create, update, view and delete data sets and custom forms. A data set is a collection of data elements for which data is entered.
 intro_dataset_section=Create, update, view and delete data set sections. Sections can be inserted into data sets to make them more comprehensible.
 intro_dataset_assignment_editor=Assign data sets to organisation units in a grid based layot for faster operations when working with a high number of items.
 edit_compulsory_data_elements=Edit compulsory data elements
-available_datasets=Available DataSets
-selected_datasets=Selected DataSets
-orgunit_tree=Organisation Unit Tree
 dataset_assignment_editor=Dataset Assignment Editor
 new=Add new
-choose_dataset=Select dataset first
-add_success=Add successfully
 delete_success=Delete successfully
-rename_success=Rename successfully
-rename_failed=Rename failed
 select=[Select]
 save_success=Saved successfully
 save_close=Save and close
-dataset_association_management=Dataset Association Management
 period_type=Period type
-organisation_unit_level=Organisation unit level
-select_period_type=Select period type
-select_level=Select level
-get_data=Get data
 datasets=DataSets
-org_units=Organisation Units
 data=Data
 pivot=Pivot
 please_select_dataset_or_categorycombo=Please select a dataset/category combo
-confirm_save=This operation will change the old orgunits assigned to these datasets.\nAre you sure to save this?
-not_change_old_but_assign_new_only=Do not change the old assignment but assign new only.
-datasets_different_orgunitlist=These selected datasets are not the same the list of organsation unit.
-optional=Optional expansion
 indicator_already_inserted=Indicator already inserted
 no_indicator_was_selected=No indicator was selected
 dataelement_already_inserted=Data element already inserted
@@ -140,4 +81,4 @@
 show_selection_box=Show selection box
 grey_field=Grey field
 totals=Totals
-expiry_days=Expiry Days
+expiry_days=Expiry Days
\ No newline at end of file

=== added file 'resources/util/find_unused_keys.sh'
--- resources/util/find_unused_keys.sh	1970-01-01 00:00:00 +0000
+++ resources/util/find_unused_keys.sh	2012-02-21 11:39:05 +0000
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Lists all property keys which are not used in source code.
+
+# Run this program from root of a web project after cleaning target dir.
+
+# First argument is the properties file to investigate.
+
+if [[ $# -lt 1 ]]; then
+    echo "Usage: $0 properties-file"
+    exit 1
+fi
+
+echo "Keys not in use in file: $1"
+echo
+
+for i in $( cat $1 ); do
+  if [[ $i =~ (^.*)(=| =).* ]]; then
+    KEY=${BASH_REMATCH[1]}
+    MATCH=`find . -name "*.java" -o -name "*.vm" -o -name "*.js" -o -name "*.html" | xargs grep $KEY`
+    LENGTH_OF_MATCH=${#MATCH}
+    if [[ ${LENGTH_OF_MATCH} == 0 ]]; then
+      echo ${KEY}
+    fi
+  fi
+done