Page 1 of 1

Where is general.phrase.overview-for coming from in bolt ?

Posted: Mon Oct 10, 2016 11:34 pm
by gautamz07
I was just going through the default twig theme files in bolt CMS and came across the following lines of code , in the listing.twig file.

Code: Select all

{% if taxonomytype is defined %}
            <h1>
                {{ __('general.phrase.overview-for') }}
                {% if taxonomy.options[slug] is defined %}
                    {{ taxonomy.options[slug] }}
                {% else %}
                    {{ slug }}
                {% endif %}
            </h1>
            {# Taxonomies are fetched unordered by design except if 'has_sortorder'
               is set to true. This way we keep 'grouping' intact in the listing. #}
            {% if not taxonomy.has_sortorder %}
                {# If we specified an order in config.yml, sort them here, accordingly: #}
                {% set records = records|order(app.config.get('general/listing_sort')) %}
            {% endif %}
        {% endif %}
My doubt is about the below line of code:

Code: Select all

{{ __('general.phrase.overview-for') }}
The above line i believe outputs some content. But what exactly does

Code: Select all

general.phrase.overview-for
mean and where is it coming from ??

Re: Where is general.phrase.overview-for coming from in bolt

Posted: Tue Oct 11, 2016 12:29 am
by requinix
I don't know bolt, but functions named __ are typically for translations. Is there a place where those are defined?

Re: Where is general.phrase.overview-for coming from in bolt

Posted: Tue Oct 11, 2016 10:28 am
by gautamz07
requinix ,somebody actually answered that question on SO here : http://stackoverflow.com/a/39970060/4381665,

I still dont understand what it is being used for.

Also in the below line of code:

Code: Select all

{{ __('general.phrase.overview-for') }}
what is general.phrase.overview-for ?

BTW , i think celauran uses bolt , so he might have a clue :D

Re: Where is general.phrase.overview-for coming from in bolt

Posted: Tue Oct 11, 2016 11:32 am
by requinix
If you know the answer to "what is __" then you should know what the answer to "what is it being used for". Hint: it's the same answer.

"general.phrase.overview-for" is the identifier for the string.

Or wait for Celauran. Whatever.

Re: Where is general.phrase.overview-for coming from in bolt

Posted: Tue Oct 11, 2016 11:36 am
by gautamz07
actually i did't quite understand the usage of __ too :(