dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25284
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12501: Modified I18nLocale Management
------------------------------------------------------------
revno: 12501
committer: James Chang <jamesbchang@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-10-08 20:19:54 +0700
message:
Modified I18nLocale Management
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locale.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/localeForm.js
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/I18nLocale.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/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/i18n/locale/I18nLocale.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/I18nLocale.java 2013-10-06 10:34:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/I18nLocale.java 2013-10-08 13:19:54 +0000
@@ -47,7 +47,7 @@
// -------------------------------------------------------------------------
public I18nLocale()
- {
+ {
this.name = "English (United Kingdom)";
this.locale = "en_GB";
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationService.java 2013-10-01 16:44:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationService.java 2013-10-08 13:19:54 +0000
@@ -84,6 +84,14 @@
Collection<Translation> getTranslations( String className, Locale locale );
/**
+ * Retrieves a Collection of Translations.
+ *
+ * @param locale the locale.
+ * @return a Collection of Translations.
+ */
+ Collection<Translation> getTranslations( Locale locale );
+
+ /**
* Retrieves a Collection of all Translations.
*
* @return a Collection of all Translations.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java 2013-10-01 16:44:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java 2013-10-08 13:19:54 +0000
@@ -83,6 +83,14 @@
Collection<Translation> getTranslations( String className, Locale locale );
/**
+ * Retrieves a Collection of Translations.
+ *
+ * @param locale the locale.
+ * @return a Collection of Translations.
+ */
+ Collection<Translation> getTranslations( Locale locale );
+
+ /**
* Retrieves a Collection of all Translations.
*
* @return a Collection of all Translations.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java 2013-10-08 08:07:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java 2013-10-08 13:19:54 +0000
@@ -126,7 +126,7 @@
{
return false; // Country not valid
}
-
+
String localeStr = LocaleUtils.getLocaleString( language, country, null );
Locale locale = LocaleUtils.getLocale( localeStr );
@@ -151,7 +151,7 @@
{
return localeStore.getByUid( uid );
}
-
+
public I18nLocale getI18nLocale( Locale locale )
{
return localeStore.getI18nLocaleByLocale( locale );
@@ -195,4 +195,5 @@
return locales;
}
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java 2013-10-08 08:07:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java 2013-10-08 13:19:54 +0000
@@ -53,7 +53,7 @@
I18nLocale getI18nLocale( int id );
I18nLocale getI18nLocaleByUid( String uid );
-
+
I18nLocale getI18nLocale( Locale locale );
void deleteI18nLocale( I18nLocale locale );
@@ -67,4 +67,5 @@
Collection<I18nLocale> getI18nLocalesBetweenLikeName( String name, int first, int max );
List<Locale> getAllLocales();
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java 2013-10-06 07:45:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java 2013-10-08 13:19:54 +0000
@@ -81,6 +81,11 @@
return translationStore.getTranslations( className, locale );
}
+ public Collection<Translation> getTranslations( Locale locale )
+ {
+ return translationStore.getTranslations( locale );
+ }
+
public Collection<Translation> getAllTranslations()
{
return translationStore.getAllTranslations();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java 2013-10-01 16:44:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java 2013-10-08 13:19:54 +0000
@@ -28,12 +28,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Collection;
+
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.Section;
import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.i18n.locale.I18nLocale;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorGroupSet;
@@ -41,6 +44,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.hisp.dhis.system.util.LocaleUtils;
import org.hisp.dhis.validation.ValidationRule;
import org.hisp.dhis.validation.ValidationRuleGroup;
@@ -57,6 +61,13 @@
i18nService = service;
}
+ private TranslationService translationService;
+
+ public void setTranslationService( TranslationService translationService )
+ {
+ this.translationService = translationService;
+ }
+
@Override
protected String getClassName()
{
@@ -140,4 +151,22 @@
{
i18nService.removeObject( groupSet );
}
+
+ @Override
+ public String allowDeleteI18nLocale( I18nLocale i18nLocale )
+ {
+ Collection<Translation> translations = translationService.getTranslations( LocaleUtils.getLocale( i18nLocale.getLocale() ) );
+
+ if ( translations.size() == 0 )
+ {
+ return null;
+ }
+ else
+ {
+ Translation translation = translations.iterator().next();
+
+ return translation.getLocale();
+ }
+ }
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java 2013-10-06 07:45:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java 2013-10-08 13:19:54 +0000
@@ -131,6 +131,20 @@
}
@SuppressWarnings( "unchecked" )
+ public Collection<Translation> getTranslations( Locale locale )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( Translation.class );
+
+ criteria.add( Restrictions.eq( "locale", locale.toString() ) );
+
+ criteria.setCacheable( true );
+
+ return criteria.list();
+ }
+
+ @SuppressWarnings( "unchecked" )
public Collection<Translation> getAllTranslations()
{
Session session = sessionFactory.getCurrentSession();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-10-07 18:30:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-10-08 13:19:54 +0000
@@ -1027,6 +1027,7 @@
<bean id="org.hisp.dhis.translation.TranslationDeletionHandler" class="org.hisp.dhis.translation.TranslationDeletionHandler">
<property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
+ <property name="translationService" ref="org.hisp.dhis.translation.TranslationService" />
</bean>
<bean id="org.hisp.dhis.attribute.AttributeValueDeletionHandler" class="org.hisp.dhis.attribute.AttributeValueDeletionHandler">
@@ -1118,6 +1119,7 @@
<aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMapLegendSet(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMapView(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMap(..) )" method="intercept" />
+ <aop:before pointcut="execution( * org.hisp.dhis.i18n.I18nLocaleService.delete*(..) )" method="intercept" />
</aop:aspect>
<!-- <aop:aspect ref="i18nTranslationInterceptor"> <aop:after-returning pointcut="execution( * org.hisp.dhis.dataelement.DataElementService.get*(..)
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2013-10-01 16:44:42 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2013-10-08 13:19:54 +0000
@@ -50,6 +50,7 @@
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.expression.Expression;
+import org.hisp.dhis.i18n.locale.I18nLocale;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorGroupSet;
@@ -714,4 +715,13 @@
{
return null;
}
+
+ public void deleteI18nLocale( I18nLocale i18nLocale )
+ {
+ }
+
+ public String allowDeleteI18nLocale( I18nLocale i18nLocale )
+ {
+ return null;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java 2013-10-04 15:05:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java 2013-10-08 13:19:54 +0000
@@ -70,6 +70,10 @@
public String execute()
throws Exception
{
+ // Pass 'addI18nLocale' nulls if the value is empty
+ if ( language.isEmpty() ) { language = null; }
+ if ( country.isEmpty() ) { country = null; }
+
localeService.addI18nLocale( language, country );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java 2013-10-01 16:44:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java 2013-10-08 13:19:54 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang.StringUtils.isNotBlank;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -100,14 +101,27 @@
public String execute()
throws Exception
{
- total = localeService.getI18nLocaleCount();
-
- this.paging = createPaging( total );
-
- i18nlocales = new ArrayList<I18nLocale>( localeService.getI18nLocalesBetween( paging.getStartPos(), paging.getPageSize() ));
-
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ total = localeService.getI18nLocaleCountByName( key );
+
+ this.paging = createPaging( total );
+
+ i18nlocales = new ArrayList<I18nLocale>( localeService.getI18nLocalesBetweenLikeName( key, paging.getStartPos(),
+ paging.getPageSize() ) );
+ }
+ else
+ {
+ total = localeService.getI18nLocaleCount();
+
+ this.paging = createPaging( total );
+
+ i18nlocales = new ArrayList<I18nLocale>( localeService.getI18nLocalesBetween( paging.getStartPos(),
+ paging.getPageSize() ) );
+ }
+
Collections.sort( i18nlocales, IdentifiableObjectNameComparator.INSTANCE );
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java 2013-10-08 08:09:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java 2013-10-08 13:19:54 +0000
@@ -29,8 +29,10 @@
import java.util.Locale;
+import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nLocaleService;
import org.hisp.dhis.i18n.locale.I18nLocale;
+import org.hisp.dhis.system.util.LocaleUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -47,23 +49,27 @@
@Autowired
private I18nLocaleService localeService;
-
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
- private String language;
-
- public void setLanguage( String language )
- {
- this.language = language;
- }
-
- private String country;
-
- public void setCountry( String country )
- {
- this.country = country;
+ private String localeCode;
+
+ public void setLocaleCode( String localeCode )
+ {
+ this.localeCode = localeCode;
}
// -------------------------------------------------------------------------
@@ -83,11 +89,22 @@
public String execute()
{
- I18nLocale locale = localeService.getI18nLocale( new Locale( language, country ) );
-
- if ( locale != null )
+
+ if ( localeCode != null && localeCode != "" )
{
- return INPUT;
+ Locale locale = LocaleUtils.getLocale( localeCode );
+
+ if ( locale != null )
+ {
+ I18nLocale i18nLocale = localeService.getI18nLocale( locale );
+
+ if ( i18nLocale != null )
+ {
+ message = i18n.getString( "language_country_in_use" );
+
+ return ERROR;
+ }
+ }
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-10-04 15:05:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-10-08 13:19:54 +0000
@@ -188,6 +188,7 @@
update_sql_view=Update SQL view
name_is_null=Name is not allowed to be null
name_in_used=Name is in use
+language_country_in_use=The language and country set is already in use
sqlquery_is_empty=SQL statement cannot be null
sqlquery_is_invalid=This SQL statement is invalid.
sqlquery_is_welformed=Notes: Only SELECT query is allowed (Without INTO keyword).
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2013-10-08 09:51:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2013-10-08 13:19:54 +0000
@@ -58,6 +58,8 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-dataadmin/localeList.vm</param>
<param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+ <param name="javascripts">javascript/locale.js</param>
+ <param name="requiredAuthorities">F_LOCALE_MANAGEMENT</param>
</action>
<action name="getLocale"
@@ -91,21 +93,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-dataadmin/addLocaleForm.vm</param>
<param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
- <param name="requiredAuthorities">F_LOCALE_ADD</param>
- </action>
-
- <action name="showUpdateLocaleForm"
- class="org.hisp.dhis.dataadmin.action.locale.ShowUpdateLocaleFormAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-dataadmin/updateLocaleForm.vm</param>
- <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
- <param name="requiredAuthorities">F_LOCALE_ADD</param>
- </action>
-
- <action name="updateLocale"
- class="org.hisp.dhis.dataadmin.action.locale.UpdateLocaleAction">
- <result name="success" type="redirect">locale.action
- </result>
+ <param name="javascripts">javascript/localeForm.js</param>
<param name="requiredAuthorities">F_LOCALE_ADD</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm 2013-10-04 15:05:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm 2013-10-08 13:19:54 +0000
@@ -1,3 +1,18 @@
+<script type="text/javascript">
+ jQuery(document).ready( function(){
+
+ var rules = getValidationRules( "i18nLocale" );
+
+ validation2( 'addLocaleForm', function( form ){ form.submit(); },
+ {
+ 'rules': rules
+ });
+
+ checkValueIsExist( "localeCode", "validateLocale.action" );
+ });
+
+</script>
+
<h3>$i18n.getString( "create_new_locale" )</h3>
<form id="addLocaleForm" name="addLocaleForm" action="addLocale.action" method="post" class="inputForm">
@@ -11,28 +26,27 @@
<tbody>
<tr>
- <td><label>$i18n.getString( "language" ) </label></td>
- <td>
- <select id="language" name="language" onchange="setName()" class="{validate:{required:true}}">
+ <td style="vertical-align:top;"><label>$i18n.getString( "language" ) </label></td>
+ <td style="vertical-align:top;">
+ <select id="language" name="language" onchange="setLocaleCode()" class="{validate:{required:true}}">
<option value="">[$i18n.getString( "locale_language_no_translation" )]</option>
#foreach( $language in $availableLanguages.entrySet() )
<option value="$language.key">$language.value</option>
#end
</select>
</td>
- <td></td>
</tr>
<tr>
- <td><label>$i18n.getString( "country" ) </label></td>
- <td>
- <select id="country" name="country" onchange="setName()">
+ <td style="vertical-align:top;"><label>$i18n.getString( "country" ) </label></td>
+ <td style="vertical-align:top;">
+ <select id="country" name="country" onchange="setLocaleCode()">
<option value="">[$i18n.getString( "locale_country_no_translation" )]</option>
#foreach( $country in $availableCountries.entrySet() )
<option value="$country.key">$country.value</option>
#end
</select>
+ <input type="hidden" id="localeCode" name="localeCode" >
</td>
- <td></td>
</tr>
<tbody>
</table>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locale.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locale.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locale.js 2013-10-08 13:19:54 +0000
@@ -0,0 +1,25 @@
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showLocaleDetails( i18nLocaleId )
+{
+ jQuery.getJSON( "getLocale.action", {
+ id:i18nLocaleId
+ }, function(json){
+ setInnerHTML( 'nameField', json.i18nLocale.name );
+ setInnerHTML( 'localeField', json.i18nLocale.locale );
+
+ showDetails();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove I18nLocale
+// -----------------------------------------------------------------------------
+
+function removeLocale( i18nLocaleId, name )
+{
+ removeItem( i18nLocaleId, name, i18n_confirm_delete, 'removeLocale.action' );
+}
+
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/localeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/localeForm.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/localeForm.js 2013-10-08 13:19:54 +0000
@@ -0,0 +1,19 @@
+function setLocaleCode()
+{
+ var localeCode = "";
+
+ var language = $( '#language option:selected' );
+ var country = $( '#country option:selected' );
+
+ if( language.val() != "")
+ {
+ localeCode = language.val();
+
+ if( country.val() != "" )
+ {
+ localeCode += "_" + country.val();
+ }
+ }
+
+ setFieldValue( 'localeCode', localeCode );
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm 2013-09-25 08:46:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm 2013-10-08 13:19:54 +0000
@@ -1,9 +1,5 @@
<script type="text/javascript">
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_locale" ) , "'" )';
- //var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
- //var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'" )';
- //var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ), "'")';
-
</script>
<h3>$i18n.getString( "locale_management" ) #openHelp( "locale" )</h3>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2013-10-08 11:54:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2013-10-08 13:19:54 +0000
@@ -232,6 +232,7 @@
F_MYDATAMART_VIEW=Access my data mart
F_METADATA_EXPORT=Export Meta-Data
F_METADATA_IMPORT=Import Meta-Data
+F_LOCALE_MANAGEMENT=Locale Management
F_LOCALE_ADD=Add Locale
F_LOCALE_DELETE=Delete Locale