Description
- version: 3.3.0
node
version: v10.16.3yarn
version: 1.22.4
Do you want to request a feature or report a bug?:
Bug
What is the current behavior?:
To avoid id collisions I'd like to generate ids using the filename, so I've set filebase: true
in babel.config.js
:
module.exports = function (api) {
api.cache(true);
return {
presets: [
'module:metro-react-native-babel-preset',
],
plugins: [
[
'react-intl-auto',
{
removePrefix: 'src/',
filebase: true,
},
],
],
};
};
Used like this in the TabNavigator
-component:
const messages = defineMessages({
profile: 'Profil',
});
const TabNavigator = () => {
const {formatMessage} = useIntl();
return (
<Tab.Navigator>
<Tab.Screen
name="Profile"
component={Profile}
options={{
tabBarLabel: formatMessage(messages.profile)
}}
/>
);
}
Running extract-messages -l=en,nb -o src/translations -d nb --flat true --overwriteDefault false 'src/**/*.{ts,tsx}'
does actually generate the ids with the filename:
"navigation.TabNavigator.profile": "Profil",
But React.Intl
complains about a missing translation with the id used in formatMessage
:
(notice the lack of filename in the id)
What is the expected behavior?:
The id used in formatMessage
, FormattedMessage
etc, includes the filename when filebase
is set to true
.
Suggested solution:
Not sure what the issue is yet, if it is some fault of mine or an actual bug.