Skip to content

Make views translatable #27

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Make views translatable #27

wants to merge 1 commit into from

Conversation

tagoh
Copy link

@tagoh tagoh commented Oct 7, 2015

The UI in object-describer isn't ready to i18n. this change allows users to see translated UI.

@stefwalter
Copy link
Contributor

What is the scheme that you're using for translatable attributes? I would like to see if we can sync up between Cockpit and Openshift, and our scripts can recognize these attributes as transtlatable as well.

@stefwalter
Copy link
Contributor

@petervo @mvollmer @dperpeet FYI.

@tagoh
Copy link
Author

tagoh commented Oct 7, 2015

I chose angular-gettext https://angular-gettext.rocketeer.be/ as a platform to be translated strings and they use "translate" attribute like you can see in the changes. gettext is most familiar method for translators to work on and is well supported on the various translation services like transifex and zanata etc.

@tagoh
Copy link
Author

tagoh commented Oct 7, 2015

FWIW I'm working on OpenShift i18n as well and submit PR at openshift/origin#4332. FYI.

@stefwalter
Copy link
Contributor

We use gettext too in Cockpit, but use a different attribute syntax: translatable="yes". I like the angular-gettext syntax better, and would like to support it as well, and perhaps switch over to it.

@tagoh How do you handle translatable attribute text in angular-gettext? That is something l like this:

<tab heading="My Lovely Heading">
</tab>

@tagoh
Copy link
Author

tagoh commented Oct 7, 2015

@stefwalter they just follow the AngularJS way. in that case, there are two way to make it translatable. one is to use the filter within the interpolocation like <tab heading="{{'My Lovely Headidng'|translate}}"> and another one is to use the custom annotation. see https://angular-gettext.rocketeer.be/dev-guide/custom-annotations/

@stefwalter
Copy link
Contributor

Hmmm, that's very angular specific. Although Cockpit uses some angularjs in parts, many components in Cockpit are implemented without it. Will have to think about this further.

@tagoh
Copy link
Author

tagoh commented Oct 7, 2015

Sure. that said this shouldn't conflict to the out of box so that the translations are eventually merged into the js itself at the build time. it should still work with cockpit even I suppose.

@stefwalter
Copy link
Contributor

that said this shouldn't conflict to the out of box so that the translations are eventually merged into the js itself at the build time. it should still work with cockpit even I suppose.

Hmmm, wait. How are translations loaded? I hope not every translation is sent to the browser for all users ...

@tagoh
Copy link
Author

tagoh commented Oct 7, 2015

Hmm, it shouldn't be too much given that translations for all of languages available are fully translated. that said angular-gettext also supports the dynamic loading on demand. so it can be improved later if someone thinks it is too much. just including translations into js would be good start so far I believe.

@stefwalter
Copy link
Contributor

Cockpit does dynamic loading of languages. So please don't include them in this bower component's dist/object-describer.js. Doing so would prevent us from using that file directly.

I don't see translations compiled into dist/object-describer.js in this commit. So far, so good.

@tagoh
Copy link
Author

tagoh commented Oct 7, 2015

Okay. updated PR to load languages dynamically and added sample code to change the language on demand to index.html.

@juhp
Copy link

juhp commented Jan 5, 2016

Any more feedback on this?

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.

3 participants