angular-bootstrap-toggle icon indicating copy to clipboard operation
angular-bootstrap-toggle copied to clipboard

Translation does not load from angular-translate

Open mlenser opened this issue 8 years ago • 6 comments

I believe this to be an issue of loading partial translation files. So the data isn't loaded when you grab it, but is loaded async later. See http://i.imgur.com/F03133N.jpg for the problem.

Code used:

<toggle ng-model="jackOfAllTradesToggle" on="{{'JACK_OF_ALL_TRADES' | translate}}" off="{{'JACK_OF_ALL_TRADES' | translate}}" onstyle="btn-success" offstyle="btn-danger"></toggle>

I've verified that it does not exist when the files are loaded locally: http://plnkr.co/edit/KoxNXyUnN4te54yjnwrH?p=preview

plnkr does not allow loading partial translation files or I'd provide a reproduction for that.

Please let me know if I can provide further details.

mlenser avatar Nov 28 '15 16:11 mlenser

It randomly started working...closing issue

mlenser avatar Nov 28 '15 16:11 mlenser

Actually. It loads fine the first time, but any additional refresh loads the wrong text.

mlenser avatar Nov 28 '15 16:11 mlenser

Thanks for your feedback. It could be a great help to figure out the root cause, if you can provide more information about 'additional refresh'.

ziscloud avatar Nov 29 '15 07:11 ziscloud

So on first load of the page it works, but then if the page is refreshed the translation is lost.

Cannot reproduce it on plnkr yet as I believe it's related to the async call to the external translation file which doesn't seem to work on plnkr, but I'll see if I can find an example where loading partials works on plnkr.

mlenser avatar Nov 29 '15 10:11 mlenser

it seems the translate issue appears in 0.1.3 again. it works for 0.1.2

tcp-wegener avatar Nov 07 '17 21:11 tcp-wegener

it seems the translate issue appears in 0.1.3 again. it works for 0.1.2

Hi,

had the same issue in the 0.4.2 release. Solution that worked for me is adding the following lines at the beginning of the computeStyle declaration:

var onElement = angular.element(self.onElement); var offElement = angular.element(self.offElement); onElement.html(self.on); offElement.html(self.off);

Hope that helps you too.

mmaaddaass avatar Jul 26 '19 08:07 mmaaddaass