开源软件名称(OpenSource Name):rmariuzzo/laravel-localization-loader开源软件地址(OpenSource Url):https://github.com/rmariuzzo/laravel-localization-loader开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):Features
Installationnpm install laravel-localization-loader --save-dev or yarn add laravel-localization-loader --dev ConfigurationWebpack 2+// webpack.config.js
module.exports = {
module: {
rules: [
{
// Matches all PHP or JSON files in `resources/lang` directory.
test: /resources[\\\/]lang.+\.(php|json)$/,
loader: 'laravel-localization-loader',
}
]
}
} Laravel Mix// webpack.mix.js
mix.webpackConfig({
module: {
rules: [
{
// Matches all PHP or JSON files in `resources/lang` directory.
test: /resources[\\\/]lang.+\.(php|json)$/,
loader: 'laravel-localization-loader',
}
]
}
}); UsageLang.jsFirst, you will need to install Lang.js then you may want to create a // messages.js
export default {
// The key format should be: 'locale.filename'.
'en.messages': require('../../resources/lang/en/messages.php'),
'es.messages': require('../../resources/lang/es/messages.php'),
'en.auth': require('../../resources/lang/en/auth.php'),
'es.auth': require('../../resources/lang/es/auth.php'),
} Then somewhere else in your awesome app: // page.js
import Lang from 'lang.js'
import messages from './messages'
const lang = new Lang({ messages })
lang.get('messages.hello') Profit! Development
Test
Coverage
Publish
Made with |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论