AtlasOfLivingAustralia / biocache-hubs

Biocache Hub UI grails plugin
Other
3 stars 30 forks source link

i18n not properly loaded in biocache-hubs #505

Closed alexhuang091 closed 7 months ago

alexhuang091 commented 2 years ago

See the display of user assertion name

good

bad

alexhuang091 commented 2 years ago

I turned on debug for i18n loading

if (typeof BC_CONF != 'undefined' && BC_CONF.hasOwnProperty('contextPath')) {
    jQuery.i18n.properties({
        name: 'messages',
        path: BC_CONF.contextPath + '/messages/i18n/',
        mode: 'map',
        async: true,
        cache: true,
        language: BC_CONF.locale, // default is to use browser specified locale
        debug: true,
        callback: finishloading
    });
}

function finishloading() {
    console.log('alex i18n loading finished -----------');
}

You can see jQuery.i18n.prop[geospatialIssue] = [geospatialIssue] is called before first properties file is loaded. thus no translation is returned.

jquery-migration.min.js:4 JQMIGRATE: Migrate is installed with logging active, version 3.0.1
jquery-migration.min.js:4 JQMIGRATE: jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos
u @ jquery-migration.min.js:4
get @ jquery-migration.min.js:4
x.widget @ autocomplete.min.js:13
(匿名) @ autocomplete.min.js:42
(匿名) @ autocomplete.min.js:5
(匿名) @ autocomplete.min.js:5
jquery-migration.min.js:4 console.trace
u @ jquery-migration.min.js:4
get @ jquery-migration.min.js:4
x.widget @ autocomplete.min.js:13
(匿名) @ autocomplete.min.js:42
(匿名) @ autocomplete.min.js:5
(匿名) @ autocomplete.min.js:5
c505c4f6-71c5-48be-90ef-6779ea1419a6:1 Tracking Prevention blocked a Script resource from loading https://www.google-analytics.com/analytics.js.
c505c4f6-71c5-48be-90ef-6779ea1419a6:3697 GET https://www.google-analytics.com/analytics.js net::ERR_BLOCKED_BY_CLIENT
10Tracking Prevention blocked access to storage for <URL>.
jquery.i18n.properties.js?compile=false:27 i18n::totalFiles: 3
jquery.i18n.properties.js?compile=false:27 i18n::loadAndParseFiles
jquery.i18n.properties.js?compile=false:27 i18n::loadAndParseFile('/ala-hub/messages/i18n/messages.properties')
jquery.i18n.properties.js?compile=false:27 i18n::totalFiles: 3
jquery.i18n.properties.js?compile=false:27 i18n::filesLoaded: 0
show.js?compile=false:444 refresh user annotation ========== 
show.js?compile=false:484 userAssertion = 
show.js?compile=false:485 {qaStatus: 50005, problemAsserted: false, code: 20, dataResourceUid: 'dr17770', referenceRowKey: 'c505c4f6-71c5-48be-90ef-6779ea1419a6', …}
show.js?compile=false:495 userAssertion.name = geospatialIssue
show.js?compile=false:497 jQuery.i18n.prop[geospatialIssue] = [geospatialIssue]--------------------- alex ------- ui show here ------
jquery.i18n.properties.js?compile=false:27 i18n::Succeeded in downloading /ala-hub/messages/i18n/messages.properties. ---- first file message.properties downloaded, then to parse -------
jquery.i18n.properties.js?compile=false:27 i18n::AMBIGUOUS_COLLECTION=Ambiguous collection

AMBIGUOUS_INSTITUTION=Ambiguous institution
ASSOCIATED=Associated record
Algae=Algae

MachineObservation=Machine observation
Mammals=Mammals
Molluscs=Molluscs
Monocots=Monocots
NAME_NOT_SUPPLIED=Name not supplied
NotNull.downloadRequestParams.reasonTypeId=A reasonTypeId must be provided. See <a hre

jquery.i18n.properties.js?compile=false:27 i18n::loadAndParseFiles
jquery.i18n.properties.js?compile=false:27 i18n::loadAndParseFile('/ala-hub/messages/i18n/messages_zh.properties')
jquery.i18n.properties.js?compile=false:27 i18n::totalFiles: 3
jquery.i18n.properties.js?compile=false:27 i18n::filesLoaded: 1
jquery.i18n.properties.js?compile=false:27 i18n::Succeeded in downloading /ala-hub/messages/i18n/messages_zh.properties. ---- 2nd file messages_zh.properties downloaded, then to parse ------- 
jquery.i18n.properties.js?compile=false:27 i18n::AMBIGUOUS_COLLECTION=Ambiguous collection

AMBIGUOUS_INSTITUTION=Ambiguous institution
ASSOCIATED=Associated record
Algae=Algae

Mammals=Mammals
Molluscs=Molluscs
Monocots=Monocots
NAME_NOT_SUPPLIED=Name not supplied
NotNull.downloadRequestParams.reasonTypeId=A reasonTypeId must be provided. See <a hre

jquery.i18n.properties.js?compile=false:27 i18n::loadAndParseFiles
jquery.i18n.properties.js?compile=false:27 i18n::loadAndParseFile('/ala-hub/messages/i18n/messages_zh_CN.properties')
jquery.i18n.properties.js?compile=false:27 i18n::totalFiles: 3
jquery.i18n.properties.js?compile=false:27 i18n::filesLoaded: 2
jquery.i18n.properties.js?compile=false:27 i18n::Succeeded in downloading /ala-hub/messages/i18n/messages_zh_CN.properties. ---- 3rd file messages_zh_CN.properties downloaded, then to parse -------  
jquery.i18n.properties.js?compile=false:27 i18n::AMBIGUOUS_COLLECTION=Ambiguous collection

AMBIGUOUS_INSTITUTION=Ambiguous institution
ASSOCIATED=Associated record
Algae=Algae
Amphibians=Amphibians
Angiosperms=Angiosperms
Animals=Animals

jquery.i18n.properties.js?compile=false:27 i18n::loadAndParseFiles
jquery.i18n.properties.js?compile=false:27 i18n::callbackIfComplete()
jquery.i18n.properties.js?compile=false:27 i18n::totalFiles: 3
jquery.i18n.properties.js?compile=false:27 i18n::filesLoaded: 3
biocache-hubs.js?compile=false:22 alex i18n loading finished -----------
nickdos commented 2 years ago

Not sure if this is the same cause but annotations are still showing up with [undefined] - flagged by Foo bar.

adam-collins commented 7 months ago

Refactored this code recently.