草庐IT

ng2-translate

全部标签

ruby-on-rails - Rails 3 I18 : translation missing: da. datetime.distance_in_words.about_x_hours

我看到这个错误:translationmissing:da.datetime.distance_in_words.about_x_hours我的语言环境文件:http://pastie.org/2944890我的看法:我已将其添加到我的application.rb中:config.i18n.load_path+=Dir[Rails.root.join('my','locales','*.{rb,yml}').to_s]config.i18n.default_locale=:da如果我删除I18配置,帮助程序会处理英语。更新:我在config/enviorments/devolpment

ruby-on-rails - 运行 Heckle 时出错? `current_code' : undefined method `translate' for Ruby2Ruby

我正在尝试运行Heckle,但一直出现错误:>specspec/controllers/my_controller_spec.rb--heckleMyController!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!exception=hasathickskin.There'snothingtoheckle.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(Runsthroughseveralmu

ruby-on-rails - Rails 国际化 : %{record} is not being translated

我的rails.pt-BR.yml上有这个:br:errors:format:!'%{attribute}%{message}'messages:restrict_dependent_destroy:one:"Nãoépossívelexcluiroregistropoisexisteum%{record}dependente"many:"Nãoépossívelexcluiroregistropoisexistem%{record}dependentes"在我的模型中,我有这个:has_many:entities,dependent::restrict_with_error每当res

ruby-on-rails - I18n : How to check if a translation key/value pairs is missing?

我正在使用RubyonRails3.1.0和I18ngem.我(正在实现一个插件)我想在运行时检查I18n是否缺少翻译键/值对,如果是,则使用自定义字符串。也就是说,我有:validates:link_url,:format=>{:with=>REGEX,:message=>I18n.t('custom_invalid_format',:scope=>'activerecord.errors.messages')}如果.yml文件中没有如下代码activerecord:errors:messages:custom_invalid_format:Thisisthetesterrormes

javascript - 带有数据切换的 AngularJS ng-click

我有一个列表项,它切换模式并使用ng-click设置一个参数问题是在记录Course.SelectedCourse的任何其他地方调用函数时,它是未定义的,尽管Course.ID有一个值。 最佳答案 在Controller中使用一个函数,这可能看起来像这样:在View中:在Controller中functionsetSelectedCourse(course_id){$scope.Course.SelectedCourse=course_id;} 关于javascript-带有数据切换的A

javascript - AngularJS:如何使用 ng-idle

我目前的情况是:myApp.config(['$routeProvider',function($routeProvider){$routeProvider.when('/home',{templateUrl:'partials/home.html',controller:'homeCtrl'});}这是我当前的.config()我如何将波纹管代码集成到我的上层代码中:.config(function(IdleProvider,KeepaliveProvider){IdleProvider.idle(10*60);//10minutesidleIdleProvider.timeout(

javascript - 为什么不添加 ng-leave/ng-enter 类

根据Angular文档https://docs.angularjs.org/api/ng/directive/ngRepeat#animations".enter-whenanewitemisaddedtothelistorwhenanitemisrevealedafterafilter.leave-whenanitemisremovedfromthelistorwhenanitemisfilteredout"然而,当我从数组中调用.push({})或.splice(-1,1)时,这些类都没有添加到ng-repeat中。有什么问题吗?addremove{{$index}}varmyAp

javascript - 在 ng-if 中设置监视元素

假设我有以下观点:在Controllersome中设置:foo.controller('fooFoo',functionfooFoo($scope){$scope.some="something";$scope.$watch('foo.Bar',function(nVal,oVal){etc...});});如果输入位于带有ng-if的div中,则watch不起作用。为什么?我能以某种方式让它发挥作用吗? 最佳答案 您必须在Controller中创建foo的空对象。foo.controller('fooFoo',functionfo

javascript - 使用搜索输入字段过滤 ng-repeat 中的嵌套对象

我正在尝试使用搜索文本框过滤ng-repeat中的嵌套对象。给定以下对象:$scope.items={"1":{name:"FirstItem",tag:"first"},"2":{name:"SecondItem",tag:"second"}};我想做这样的事情:Usingboth{{key}}and{{values.name}}这确实不行。我尝试了很多东西,但无法使其正常工作。我不想改变我的对象。我搜索了很多,但没有找到适合我需要的东西。 最佳答案 我终于找到了我自己问题的答案。我只需要创建自己的过滤器并使用正则表达式检查对象内

javascript - 如何使用不在 Angular 中另一个数组中的值过滤 ng-repeat?

有没有什么方法可以使用Angular过滤器将值与数组中的每个值进行比较?Categories:{{c}}我想显示i.categories中不在myArray中的值:$scope.i={categories:["Europe&Eurasia","Featured","Headlines","MiddleEast","News","NEWSBYTOPIC","NewsCategories","REGIONALNEWS"]};$scope.myArray=['Featured','Headlines','News'];我想从c获取不包含在myArray中的所有内容。我尝试编写一些函数,但由于