-
Notifications
You must be signed in to change notification settings - Fork 18
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
menu-config internationalization #428
base: master
Are you sure you want to change the base?
menu-config internationalization #428
Conversation
ace.js npm path
# Conflicts: # grails-app/assets/javascripts/spApp/service/i18nService.js # grails-app/i18n/messages_de.properties
_Events.groovy def p = new File(baseDir + '/grails-app/i18n/messages.properties') // test refere to data dir //def p = new File('/data/spatial-hub/i18n/messages.properties')
toDo spatial service on linux language to complete!
within using the message.properties numbers as variables in addition to menu-config.json "name": "Name" "i18nNr": "number"
_Events.groovy
Outdated
println 'Starting NPM install' | ||
final workdir = new File(baseDir, '') | ||
final proc = new ProcessBuilder().inheritIO() | ||
final exec = proc.command('npm', '-dd', 'install').start() | ||
// npm for UNIX, npm.cmd for Windows | ||
final exec = proc.command('npm.cmd', '-dd', 'install').start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see several problems in the PR. This is not related with menu-config internationalization. Please send a PR for this npm issue ensuring that your change doesn't affect others.
If we merge this, will only work in Windows (not as before).
So find a solution that works for Windows and Linux/Mac systems (detecting the platform or similar).
With a PR using upstream code with only this change, will be easy to review and merge. The same with others changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw run.cmd has been fixed. Shall we only cherry-pick internationalisation part or merge all? @vjrj
@@ -25,22 +25,22 @@ | |||
} | |||
}, | |||
{ | |||
"description": "Species options.", | |||
"description": $i18n(411), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a default value, like: $i18n(411, "Species options."). It would give developers a direct hint : it is "Species options.".
I have added a new $i18n(k, v) method to support this functionality
Hello,
yes I think so! If the default value is the english descriptive name
it will be easier to match the descriptive names of the other languages
and we wouldn’t have to match them over the numbers.
Do you agree?
best regards
Georg
Von: QBai ***@***.***>
Gesendet: Montag, 1. November 2021 04:34
An: AtlasOfLivingAustralia/spatial-hub ***@***.***>
Cc: Georg Neubauer ***@***.***>; Author ***@***.***>
Betreff: Re: [AtlasOfLivingAustralia/spatial-hub] menu-config internationalization (PR #428)
@qifeng-bai commented on this pull request.
________________________________
In grails-app/assets/javascripts/spApp/service/toolAddFacetService.js<#428 (comment)>:
@@ -25,22 +25,22 @@
}
},
{
- "description": "Species options.",
+ "description": $i18n(411),
Shall we use a default value, like: $i18n(411, "Species options."). It would give developers a direct hint : it is "Species options."
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#428 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANPMCUG4CHJD3EDKLFYKFHLUJYDC7ANCNFSM5G2X72IQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Yes, we agree. At this moment, we use both ways, since historically grails i18n pipeline plugin automatically generates i18n key-value pair by using number as key. Please check our latest commits (i18n) in our dev branch. What we changed: Add a new function $i18n = function (k, v) in spApp.js . Add a new parameter v, if cannot find key in i18n properties, use V as default. - also, it can be a hint when the key is a number. for example : In menuService.js, we merged your code for dynamic menu with small changes -> using name as key, not your i18nNr In message.properties, we added few examples of 'descriptive names' as key we also support If 'Add to map' cannot be found in message.properties, it will use 'Add to map' as value Cheers |
Hello,
that sounds perfect!
thanks for the task!
Cheers
…________________________________
Von: QBai ***@***.***>
Gesendet: Mittwoch, 3. November 2021 01:11
An: AtlasOfLivingAustralia/spatial-hub ***@***.***>
Cc: Georg Neubauer ***@***.***>; Author ***@***.***>
Betreff: Re: [AtlasOfLivingAustralia/spatial-hub] menu-config internationalization (PR #428)
o! If the default value is the english descriptive name it will be easier to match the descriptive names of the other languages and we wouldn’t have to match them over the numbers.
Yes, we agree.
At this moment, we use both ways, since historically grails i18n pipeline plugin automatically generates i18n key-value pair by using number as key.
Please check our latest commits (i18n) in our dev branch. What we changed:
Add a new function $i18n = function (k, v) in spApp.js . Add a new parameter v, if cannot find key in i18n properties, use V as default. - also, it can be a hit when the key is a number. for example :
$i18n(411, "Species options.").
In menuService.js, we merged your code for dynamic menu with small changes -> using name as key, not your i18nNr
In message.properties, we added few examples of 'descriptive names' as key
Add\ to\ map=Add to map
Cheers
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#428 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANPMCUFWAFNXZV4BQVUVY2DUKB43LANCNFSM5G2X72IQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Sincerely, I still see a mix of things here, and I see difficult to cherry-pick, but it's my impression. Also other minor things should be addressed like: |
Thanks, @vjrj . I will follow up it after I finish my current tasks |
Dear community,
I tried to do internationalization to the menu-config.json
by adding i18nNr variable refering to the message.properties numbers of spatial-hub
I changed menuServcie.js when menu data is loaded to:
if ($SH.menu.indexOf('http') == 0) {
var setup = $http.get($SH.menu, _httpDescription('getMenu')).then(function (data) {
var it_0 = 0;
var it_1 = 0;
for(it_0 = 0; it_0 < data.data.length; it_0++) {
data.data[it_0].name = $i18n(data.data[it_0].i18nNr);
for(it_1 = 0; it_1 < data.data[it_0].items.length; it_1++) {
data.data[it_0].items[it_1].name = $i18n(data.data[it_0].items[it_1].i18nNr);
}
}
menuConfig = data.data;
return menuConfig;
});
} else {
menuConfig = $SH.menu;
setup = $q.when(menuConfig)
}
Excuse me, but there are other unneeded changes in this too - I applied a window.getCookie('lang') for switching language
all over the atlas which won't be needed by all of us
We added the String names of the menu-config.json file into our message.properties within incemented numbers
best regards
Georg Neubauer