-
Notifications
You must be signed in to change notification settings - Fork 154
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
Add Textdomain Support #115
Conversation
There are no breaking changes. When you don't specify a textdomain, it defaults to "default". |
Unless there's a really compelling case to add domains, I'd rather not have them. Domains add little value: you can solve the same problems by reorganising your source code (make separate catalogues for multiple folders) and a translation memory. |
I will give you a few reasons for having domains:
I posted this screenshot in #95. Your response was that I could have a directory like so:
Which my project does. But the problem here is when I have strings that can be used across multiple controllers/sections of the project, like the Tour, Locations, and Default. In this case, those strings will be split up around each of the other domains. Gettext Textdomains were added for a reason. Why not add them since they are used by other people, like myself and @adepretis. The difference is only a couple dozen bytes and tests are included. |
Here's another one: Words exist where verb and substantive are equal in English, but may not in another language. Consider the word File that can be used as a column header for file names, and a button that is used to file an entry. When translating to German, two different translations are needed. Both strings may occur within the same page and cannot be separated easily. I recently had such a case, and the only workaround for me was to use identifier (like LABEL_BUTTON_FILEENTRY), which unnecessarily increased the translation effort. If I had domains, I could easily separate those two strings. |
@rubenv, agreed that what @thewilli suggested is a use case for contexts and not domains. But each of the other reasons are very much compelling reasons to support domains. If you need me to work on the tool-side of things to support the extraction of strings with textdomain support, I can. I just don't want to waste my time if you're not going to be adamant about not supporting this feature. Please consider this feature. They are part of the spec for a reason. |
I really appreciate your efforts to get angular-gettext to support domains, @kevinmartin. I totally agree that gettext domains were added for a reason, and I don't understand why someone would deliberately cripple a gettext library implementation by not supporting them. I like your suggested filter syntax too. My use cases actually match two of your examples above:
+1 for this feature, and great work, @kevinmartin! |
We really need this feature in a couple of projects I'm working on. I've experienced problems trying to convince @rubenv based on GNU gettext's 20-year long history and our experiences using it during that time (well, since 1996 for my own sake): rubenv/grunt-angular-gettext#13. In this case, I think you've done a much better job trying to convince him, and anyone else, about the necessity of this feature. You've even provided pull-request with passing tests.
Update: |
@mtr, I would be willing to create a fork, but I cannot guarantee that it will stay up to date with @rubenv's changes. I am implementing translations on my app tomorrow and I need this feature done by then. Unfortunately, there is no textdomains extractor at the moment, either. I am willing to create it, but once again, I'd rather it be supported by the main project than a fork. @rubenv, please recognize the need for this feature from many different commenters. I am willing to create the extractor and whatever else is needed to have this small feature come to fruition. |
@kevinmartin, can you provide more information on this example? I'm having a hard time picturing this. |
@gabegorelick, @rubenv suggested that I split up my We extracted all of the tour strings into it's own The other issue is with Locations. In locations, we have every country and US states translatable. We use these translations across many of our controllers. Because of this, we would not have a centralized location for our locations translations and they will be duplicated across every controller. This is both counter-productive and not DRY (Don't Repeat Yourself). At the end of the day, as well, more strings also means more I have to pay in Transifex. |
I think I finally get it. Thanks for humoring me :) I can get behind this in principle. If your catalogs truly are cross Disclaimer: my opinion doesn't mean anything On Friday, November 14, 2014, Kevin Jose Martin [email protected]
|
I want to land support for contexts before we consider this, especially since some of the APIs conflict with how contexts would get implemented, e.g. @kevinmartin and anyone else who wants to help, please take a look at rubenv/angular-gettext-tools#55 and give feedback. You all seem like smart people, so I value your opinions. |
First of all, apologies for the radio silence. I was out in Africa and swamped by work upon returning. Recapping from #95:
So back to your example @kevinmartin:
I'm assuming each page looks something like this:
Given that the tour will work the same on each page, it's probably a directive of some sort. Why not have it reference a file and use Which leads to:
Or put them in a separate folder:
Why yes, I'm contradicting myself here: this is a different structure. But I'd argue that it's a better one: it puts all the tour content in an easy to recognize location, which makes it even easier for the marketing specialists to take ownership. You can configure grunt with file patterns that put each string in non-tour pages in one catalog and each tour page in another catalog. Is it a hack? Yup, but only slightly. Annotating each and every string with a domain is an even greater hack, at the cost of much added complexity. Have you tried an approach like this? Or at least considered it? It's not that I don't want domains, it's that it adds loads of pain which I wouldn't recommend to anyone, while you can obtain pretty much the same result in other ways (though we obviously disagree on that).
We pretty much have the same situation (with countries). I'm quite sure how this is a problem. Why don't you throw all these strings into one place (as in a factory or a service) and reference them from each controller? Could you elaborate a bit further on this one, perhaps I'm misunderstanding the issue? |
👍 I would really appreciate if this would be merged into this project. Well done @kevinmartin! |
What is the status on this implementation? I am for one definitely looking for such functionality. |
Would be a great feature! Why is it still not merged? ;) |
I'm surprised this feature isn't yet implemented. it is required to support the internationalization on projects which uses multiple modules like AngularJS as this project is also supposed to work on, right? |
The full reasoning why this won't go in is here: #115 (comment) I'm closing this issue. Anyone who can demonstrate a common real-life problem that is currently impossible with angular-gettext: feel free to open a new issue. Fact is that a good project setup removes the need for domains: proper project structure has large benefits outside i18n alone. |
Using either syntax:
Works with Contexts/Interpolation and Plurals
Tests are included