-
Notifications
You must be signed in to change notification settings - Fork 3
NGSTACK-829 add translation indication below object name #10
NGSTACK-829 add translation indication below object name #10
Conversation
| <a href="{{ url }}">{{ content_type.name }}</a> | ||
| {% set locale_conversion_map = ibexa.configResolver.getParameter('locale.conversion_map', 'ngsite') %} | ||
| {% for language in content.versionInfo.languages %} | ||
|   {{ locale_conversion_map[language.languageCode]|split('_')|last|nglayouts_country_flag|raw }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
  (should be btw) is an error here I guess? Why not just separate languages with commas?
Also, don't use nglayouts_country_flag, this package cannot depend on Netgen Layouts. If needed, implement a custom Twig function to fetch the language name with LanguageService from Ibexa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, don't use nglayouts_country_flag, this package cannot depend on Netgen Layouts. If needed, implement a custom Twig function to fetch the language name with LanguageService from Ibexa.
Nije greška, komentar na povezanom tasku na fini glasi:
"pliz ne zaboravi dodat razmak između content tip linka i ovih zastavica. Na Fini je nabijeno"
Može se promijenit, al meni se i ovo čini ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is project code, this is open source. This open source package cannot depend on Netgen Layouts. And since there will be no flags, there should be a comma separating the language names.
The alternative is to reimplement here the function to generate flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iherak suggested we put this in media-site instead of here. Your thoughts?
Not ideal. Only new websites will then benefit from that unless we proactively implement it on older sites. Upgradablilty is also a problem. The template is not completely trivial, so any change here later will need to be propagated manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iherak suggested we put this in media-site instead of here. Your thoughts?
Not ideal. Only new websites will then benefit from that unless we proactively implement it on older sites. Upgradablilty is also a problem. The template is not completely trivial, so any change here later will need to be propagated manually.
@emodric Do you have a suggestion then?
EDIT: Reiplement the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion still stands. Just list the comma separated language names. Implement a Twig function to fetch the language by its language code and use the language object to fetch the name e.g. ngadmin_language('cro-HR').name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emodric Is this ok now?
| public function getFilters() | ||
| { | ||
| return [ | ||
| new TwigFunction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're using a Twig function under filters. This should be moved to getFunctions.
| { | ||
| return [ | ||
| new TwigFunction( | ||
| 'show_language_name', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ngadmin_language so we can fetch the object instead of the name, which allows some more flexibility.
| } | ||
|
|
||
| /** | ||
| * @throws NotFoundException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method does not throw, so this is redundant.
| {% for language in content.versionInfo.languages %} | ||
| {% set array = array|merge([language.languageCode|show_language_name]) %} | ||
| {% endfor %} | ||
|   {{array|join(', ') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
  is not needed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not add the list of languages below the content type name?
Besides,   should really be (with a semicolon).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk, flags were in the same row. It can be either way I guess: This is how it was done originally so I didn't change it.
|
Wait wait wait wait... It seems that |
Done |
| </a> | ||
| <a href="{{ url }}">{{ content_type.name }}</a> | ||
|
|
||
| {% set array = [] %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final nitpick, this variable should be named something like languages or language_names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| </a> | ||
| <a href="{{ url }}">{{ content_type.name }}</a> | ||
|
|
||
| {% set language_names = [] %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the logic within span if we are rendering this outside of the span? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved
pspanja
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems I missed this. Thanks @ljacmi!


No description provided.