Skip to content
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

Translating when translation keys are setup in the controller #17

Open
gercheq opened this issue Feb 14, 2018 · 0 comments
Open

Translating when translation keys are setup in the controller #17

gercheq opened this issue Feb 14, 2018 · 0 comments

Comments

@gercheq
Copy link

gercheq commented Feb 14, 2018

What's the best way to make angular-translate-extract work with the following setup?

I'm getting {{ feature.title }} in my en_US.json file instead of seeing all the titles ie. FeatureEventsItem1Title, FeatureEventsItem2Title...

features.controller.js

$scope.eventManagementFeatures = [
                {
                    title: "FeatureEventsItem1Title",
                    subtitle: "FeatureEventsItem1Description",
                    image: HomeFeaturesImagesFolder + "/event_management/event1.png"
                },

                {
                    title: "FeatureEventsItem2Title",
                    subtitle: "FeatureEventsItem2Description",
                    image: HomeFeaturesImagesFolder + "/event_management/event2.png"
                },
                {
                    title: "FeatureEventsItem3Title",
                    subtitle: "FeatureEventsItem3Description",
                    image: HomeFeaturesImagesFolder + "/event_management/event3.png"
                },
                {
                    title: "FeatureEventsItem4Title",
                    subtitle: "FeatureEventsItem4Description",
                    image: HomeFeaturesImagesFolder + "/event_management/event4.png"
                },
                {
                    title: "FeatureEventsItem5Title",
                    subtitle: "FeatureEventsItem5Description",
                    image: HomeFeaturesImagesFolder + "/event_management/event5.png"
                },
                {
                    title: "FeatureEventsItem6Title",
                    subtitle: "FeatureEventsItem6Description",
                    image: HomeFeaturesImagesFolder + "/event_management/event6.png"
                }
            ];

features.html

  <div class="Features-articleItem"
            ng-repeat="feature in eventManagementFeatures">
        <div class="container">
            <div class="row">
                <div class="row-height">
                    <div class="col-sm-4 col-sm-height col-sm-middle">
                        <img ng-src="{{ feature.image }}"/>
                    </div>
                    <div class="col-sm-8 col-sm-height col-sm-middle">
                        <h2 translate="{{ feature.title }}"></h2>
                        <p class="lead" translate="{{ feature.subtitle }}"></p>
                    </div>
                    <div class="col-sm-4 col-sm-height col-sm-middle">
                        <img ng-src="{{ feature.image }}"/>
                    </div>
                </div>
            </div>
        </div>

en_US.json

{
    "HELLO": "Hello",
    "{{ feature.title }}": "",
    "{{ feature.subtitle }}": "",
}
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

No branches or pull requests

1 participant