Skip to content

Conversation

DuffMck
Copy link

@DuffMck DuffMck commented Jul 12, 2017

Hi,

I've introduced support for internationalization and Italian translation, if you like it you can merge my code!

Inside the option object now you can find the field "language" where users can only choose it|en (default) right now. More languages can maybe be added by someone else.

By,
David

@vincentjames501
Copy link
Owner

This is looking good. I made some simple comments and just curious what your thoughts are on them.

@vincentjames501
Copy link
Owner

@DuffMck , thoughts on my comments?

@DuffMck
Copy link
Author

DuffMck commented Aug 2, 2017

Sorry, I haven't find your comments... can you give me the link to the file/s where they are?

Copy link
Owner

@vincentjames501 vincentjames501 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I never started the review. My bad.

'THU': 'Thursday',
'FRI': 'Friday',
'SAT': 'Saturday'
'en': {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rather than these being localized individually, these should just be the lookup keys in the provided translations map so that way there is only one place people have to go to add translations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, next week I hope to have enough time change this one

@@ -705,7 +706,87 @@ var CronGenTimeSelect = function CronGenTimeSelect($scope, cronGenService) {
};
CronGenTimeSelect.$inject = ["$scope", "cronGenService"];

angular.module('angular-cron-gen', []).service('cronGenService', CronGenService).component('cronGenTimeSelect', {
angular.module('angular-cron-gen', ['pascalprecht.translate']).config(["$translateProvider", function ($translateProvider) {
$translateProvider.translations('en', {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't used this library (we rolled our own i18n lib internally before something like this existed). Should we namespace these localization keys? Can this blow away someone else's localizations? Does this merge into their existing english/Italian translations (hopefully it doesn't blow it away)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it's possible, but I must check. Probably I should find some more smart way to passing translations I will make some tries!

'ngInject';

this.parsedOptions = this.mergeDefaultOptions(this.options);

$translate.use(this.parsedOptions.language);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since they are going to have to require angular translate in their project, would it make sense to just remove the language setting from here and just use whatever has been previously set and if someone wants to configure it they just have to call that prior to component initialization? Does it choose a reasonable default if use isn't called (again, not an expert in this library)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it has sense, the solution of the next point probably solve this one too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants